Package io.microsphere.util
Class VersionUtils
- java.lang.Object
-
- io.microsphere.util.VersionUtils
-
-
Field Summary
Fields Modifier and Type Field Description static VersionCURRENT_JAVA_VERSIONTheVersioninstance for current Java Versionstatic VersionJAVA_VERSION_10TheVersioninstance for Java 10static VersionJAVA_VERSION_11TheVersioninstance for Java 11static VersionJAVA_VERSION_12TheVersioninstance for Java 12static VersionJAVA_VERSION_13TheVersioninstance for Java 13static VersionJAVA_VERSION_14TheVersioninstance for Java 14static VersionJAVA_VERSION_15TheVersioninstance for Java 15static VersionJAVA_VERSION_16TheVersioninstance for Java 16static VersionJAVA_VERSION_17TheVersioninstance for Java 17static VersionJAVA_VERSION_18TheVersioninstance for Java 18static VersionJAVA_VERSION_19TheVersioninstance for Java 19static VersionJAVA_VERSION_20TheVersioninstance for Java 20static VersionJAVA_VERSION_21TheVersioninstance for Java 21static VersionJAVA_VERSION_22TheVersioninstance for Java 22static VersionJAVA_VERSION_23TheVersioninstance for Java 23static VersionJAVA_VERSION_24TheVersioninstance for Java 24static VersionJAVA_VERSION_8TheVersioninstance for Java 8static VersionJAVA_VERSION_9TheVersioninstance for Java 9static javax.lang.model.SourceVersionLATEST_JAVA_VERSIONThe latestJava Release Version
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static booleantestCurrentJavaVersion(Version.Operator versionOperator, Version comparedVersion)Determine whethercurrent Java versionmatches the specified versionstatic booleantestCurrentJavaVersion(java.lang.String operatorSymbol, Version comparedVersion)Determine whethercurrent Java versionmatches the specified versionstatic booleantestVersion(Version baseVersion, Version.Operator versionOperator, Version comparedVersion)Determine whether the base version matches the compared versionstatic booleantestVersion(java.lang.String baseVersion, java.lang.String operatorSymbol, java.lang.String comparedVersion)Determine whether the base version matches the compared version
-
-
-
Method Detail
-
testCurrentJavaVersion
public static boolean testCurrentJavaVersion(java.lang.String operatorSymbol, Version comparedVersion)Determine whethercurrent Java versionmatches the specified version- Parameters:
operatorSymbol- theVersion.OperatorcomparedVersion- theVersionto be compared- Returns:
trueifVersion.Operatormatchescurrent Java versionandcomparedVersion
-
testCurrentJavaVersion
public static boolean testCurrentJavaVersion(Version.Operator versionOperator, Version comparedVersion)
Determine whethercurrent Java versionmatches the specified version- Parameters:
versionOperator- theVersion.OperatorcomparedVersion- theVersionto be compared- Returns:
trueifVersion.Operatormatchescurrent Java versionandcomparedVersion
-
testVersion
public static boolean testVersion(java.lang.String baseVersion, java.lang.String operatorSymbol, java.lang.String comparedVersion)Determine whether the base version matches the compared versionVersionUtils.testVersion("1.8", "=", "1.8.0") == true VersionUtils.testVersion("1.8", ">=", "1.7") == true VersionUtils.testVersion("1.8", "<=", "1.7") == false VersionUtils.testVersion("1.8", "<", "1.7") == false VersionUtils.testVersion("1.8", ">", "1.7") == true- Parameters:
baseVersion- theVersionto be testedoperatorSymbol- the symbol ofVersion.OperatorcomparedVersion- theVersionto be compared- Returns:
trueifVersion.Operatormatches- Throws:
java.lang.IllegalArgumentException- if the base version or the compared version can't be resolved or the operator symbol is not supported, only supports "=", ">=", "<=", "<", ">"
-
testVersion
public static boolean testVersion(Version baseVersion, Version.Operator versionOperator, Version comparedVersion)
Determine whether the base version matches the compared version- Parameters:
baseVersion- theVersionto be testedversionOperator- theVersion.OperatorcomparedVersion- theVersionto be compared- Returns:
trueifVersion.Operatormatches
-
-