Class Version
- All Implemented Interfaces:
- Comparable<Version>
Used to compare version numbers.
See Also:
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionintbooleanbooleanReturnstrue if the specified version is equal to this version.Returns the maintenance version part (i.e. part at index 2).getMajor()Returns the major version part (i.e. part at index 0).getMinor()Returns the minor version part (i.e. part at index 1).getPart(int index) Returns the version part at the specified zero-indexed value.booleanReturnstrue if the specified version is at least this version.booleanReturnstrue if the specified version is at least this version.booleanReturnstrue if the specified version is at most this version.booleanReturnstrue if the specified version is at most this version.static VersionStatic creator.toString()
- 
Constructor Details- 
VersionConstructor- Parameters:
- value- A string of the form- "#.#..." where there can be any number of parts.
 Valid values:- "1.2" 
- "1.2.3" 
- "0.1" 
- ".1" 
 - Integer.MAX_VALUE
 
 
- 
- 
Method Details- 
ofStatic creator.- Parameters:
- value- A string of the form- "#.#..." where there can be any number of parts.
 Valid values:- "1.2" 
- "1.2.3" 
- "0.1" 
- ".1" 
 
 Can be- null .
- Returns:
- A new header bean, or null if the value isnull .
 
- 
getPartReturns the version part at the specified zero-indexed value.- Parameters:
- index- The index of the version part.
- Returns:
- The version part, never null .
 
- 
getMajorReturns the major version part (i.e. part at index 0).- Returns:
- The version part, never null .
 
- 
getMinorReturns the minor version part (i.e. part at index 1).- Returns:
- The version part, never null .
 
- 
getMaintenanceReturns the maintenance version part (i.e. part at index 2).- Returns:
- The version part, never null .
 
- 
isAtLeastReturnstrue if the specified version is at least this version.Example:assertTrue (Version.of ("1.2" ).isAtLeast(Version.of ("1" )));assertFalse (Version.of ("1.2" ).isAtLeast(Version.of ("2" )));assertTrue (Version.of ("1.2" ).isAtLeast(Version.of ("1.2.3" )));assertFalse (Version.of ("1.2.0" ).isAtLeast(Version.of ("1.2.3" )));- Parameters:
- v- The version to compare to.
- Returns:
- true if the specified version is at least this version.
 
- 
isAtLeastReturnstrue if the specified version is at least this version.Example:assertTrue (Version.of ("1.2.3" ).isAtLeast(Version.of ("1.2.3" ,false )));assertFalse (Version.of ("1.2.3" ).isAtLeast(Version.of ("1.2.3" ,true )));- Parameters:
- v- The version to compare to.
- exclusive- Match down-to-version but not including.
- Returns:
- true if the specified version is at least this version.
 
- 
isAtMostReturnstrue if the specified version is at most this version.Example:assertFalse (Version.of ("1.2.3" ).isAtMost(Version.of ("1" )));assertTrue (Version.of ("1.2.3" ).isAtMost(Version.of ("2" )));assertTrue (Version.of ("1.2.3" ).isAtMost(Version.of ("1.2" )));assertFalse (Version.of ("1.2.3" ).isAtMost(Version.of ("1.2.0" )));- Parameters:
- v- The version to compare to.
- Returns:
- true if the specified version is at most this version.
 
- 
isAtMostReturnstrue if the specified version is at most this version.Example:assertTrue (Version.of ("1.2.3" ).isAtMost(Version.of ("1.2.3" ,false )));assertFalse (Version.of ("1.2.3" ).isAtMost(Version.of ("1.2.3" ,true )));- Parameters:
- v- The version to compare to.
- exclusive- Match up-to-version but not including.
- Returns:
- true if the specified version is at most this version.
 
- 
equalsReturnstrue if the specified version is equal to this version.Example:assertTrue (Version.of ("1.2.3" ).isEqualsTo(Version.of ("1.2.3" )));assertTrue (Version.of ("1.2.3" ).isEqualsTo(Version.of ("1.2" )));- Parameters:
- v- The version to compare to.
- Returns:
- true if the specified version is equal to this version.
 
- 
equals
- 
toString
- 
compareTo- Specified by:
- compareToin interface- Comparable<Version>
 
 
-