java.lang.Comparable<JavaLanguageVersion>public interface JavaLanguageVersion extends java.lang.Comparable<JavaLanguageVersion>
| Modifier and Type | Method | Description |
|---|---|---|
int |
asInt() |
Return this version as a number, 14 for Java 14.
|
boolean |
canCompileOrRun(int otherVersion) |
Indicates if this version can compile or run code based on the passed in language version.
|
boolean |
canCompileOrRun(JavaLanguageVersion other) |
Indicates if this version can compile or run code based on the passed in language version.
|
static JavaLanguageVersion |
of(int version) |
|
static JavaLanguageVersion |
of(java.lang.String version) |
|
java.lang.String |
toString() |
Return this version as a String, "14" for Java 14.
|
static JavaLanguageVersion of(int version)
static JavaLanguageVersion of(java.lang.String version)
int asInt()
Given the type used, this method returns the simple version even for versions lower than 5.
toString()java.lang.String toString()
This method will return 1.<version> when the version is lower than 5.
toString in class java.lang.Objectboolean canCompileOrRun(JavaLanguageVersion other)
For example, Java 14 can compile or run code from Java 11, but not the opposite.
other - the language version to checktrue if this version can compile or run code from the other version, false otherwiseboolean canCompileOrRun(int otherVersion)
For example, Java 14 can compile or run code from Java 11, but not the opposite.
otherVersion - the language version to check, as an inttrue if this version can compile or run code from the other version, false otherwise