Package nl.vpro.util
Class Version<T extends Comparable<T>>
java.lang.Object
nl.vpro.util.Version<T>
- All Implemented Interfaces:
Comparable<Version<T>>
- Direct Known Subclasses:
IntegerVersion
A version is basically a string existing of a number of parts.
This base class leaves open how these parts should look like, but we supply an extension where they are integers.
The point is that these things can now be compared in the logical way, such that e.g. 5.12.0 > 5.2.0
- Since:
- 2.2
- Author:
- Michiel Meeuwissen
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
boolean
int
hashCode()
boolean
boolean
boolean
boolean
boolean
isNotAfter
(Version<T> other) boolean
isNotAfter
(T... parts) boolean
isNotBefore
(Version<T> other) boolean
isNotBefore
(T... parts) static IntegerVersion
of
(int... parts) static @PolyNull IntegerVersion
parseIntegers
(@PolyNull String string) Produces anIntegerVersion
, but ignores everything after the first hyphen.static Optional<IntegerVersion>
parseIntegersOptional
(@Nullable String string) toString()
-
Field Details
-
SEPARATOR
- See Also:
-
-
Constructor Details
-
Version
-
-
Method Details
-
parseIntegers
Produces anIntegerVersion
, but ignores everything after the first hyphen.In that way something like '5.12-SNAPSHOT' will simply be equivalent to '5.12'.
-
parseIntegersOptional
-
of
-
isAfter
-
isAfter
-
isNotAfter
-
isNotAfter
-
isBefore
-
isBefore
-
isNotBefore
-
isNotBefore
-
compareTo
- Specified by:
compareTo
in interfaceComparable<T extends Comparable<T>>
-
equals
-
hashCode
public int hashCode() -
toString
-