Package com.helger.diver.api.version
Class DVRVersion
java.lang.Object
com.helger.diver.api.version.DVRVersion
- All Implemented Interfaces:
Comparable<DVRVersion>
@Immutable
@MustImplementComparable
@MustImplementEqualsAndHashcode
public final class DVRVersion
extends Object
implements Comparable<DVRVersion>
This class contains the version of a DVR Coordinate. This can either be a
static version or a pseudo version. This version type has a specific kind of
ordering, so that versions using the classifier "SNAPSHOT" are ordered BEFORE
respective release versions. Example order:
- 1.0
- 1.1-SNAPSHOT
- 1.1
- 1.2
- 1.3-SNAPSHOT
- 1.3
- Author:
- Philip Helger
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final charSeparate between classifier and the rest (if available)static final charSeparator between major and minor and between minor and micro versionstatic final StringSpecific qualifier for "SNAPSHOT" versions" -
Method Summary
Modifier and TypeMethodDescriptionintcompareTo(DVRVersion rhs) booleanstatic StringgetAsString(com.helger.commons.version.Version aVersion) static StringgetAsString(IDVRPseudoVersion aPseudoVersion) com.helger.commons.version.Versionstatic Predicate<DVRVersion> getStaticVersionAcceptor(Set<String> aVersionsToIgnore, boolean bIncludeSnapshots) Create aPredicatethat can be used to filter static DVR versions.inthashCode()booleanbooleanstatic booleanisStaticSnapshotVersion(com.helger.commons.version.Version aVer) static booleanisStaticSnapshotVersion(String sQualifier) booleanstatic booleanisValidStaticVersion(String sVersion) Checks if the provided version is a valid static version.static DVRVersionof(com.helger.commons.version.Version aVersion) static DVRVersionof(IDVRPseudoVersion aPseudoVersion) static DVRVersionparseOrNull(String sVersion) static DVRVersionparseOrThrow(String sVersion) toString()
-
Field Details
-
QUALIFIER_SNAPSHOT
Specific qualifier for "SNAPSHOT" versions"- See Also:
-
NUMERIC_VERSION_PART_SEPARATOR
public static final char NUMERIC_VERSION_PART_SEPARATORSeparator between major and minor and between minor and micro version- See Also:
-
DEFAULT_CLASSIFIER_SEPARATOR
public static final char DEFAULT_CLASSIFIER_SEPARATORSeparate between classifier and the rest (if available)- See Also:
-
-
Method Details
-
isStaticVersion
public boolean isStaticVersion()- Returns:
trueif it is a static version,falseif it is a pseudo version- See Also:
-
isStaticSnapshotVersion
- Parameters:
sQualifier- The qualifier to check. May benull.,- Returns:
trueif the qualifier is "SNAPSHOT".- Since:
- 3.0.0
-
isStaticSnapshotVersion
- Parameters:
aVer- The version to check. May benull.,- Returns:
trueif the passed version has the the qualifier "SNAPSHOT".- Since:
- 1.0.1
-
isStaticSnapshotVersion
public boolean isStaticSnapshotVersion()- Returns:
trueif this is a static version, and if the qualifier is "SNAPSHOT".- See Also:
-
getStaticVersion
- Returns:
- The static version of this VER version. Guaranteed to be
non-
nullifisStaticVersion()returns true. - See Also:
-
isPseudoVersion
public boolean isPseudoVersion()- Returns:
trueif it is a pseudo version,falseif it is a static version- See Also:
-
getPseudoVersion
- Returns:
- The pseudo version of this VER version. Guaranteed to be
non-
nullifisPseudoVersion()returns true. - See Also:
-
getAsString
-
getAsString
-
getAsString
- Returns:
- The unified string representation of the Version.
-
compareTo
- Specified by:
compareToin interfaceComparable<DVRVersion>
-
equals
-
hashCode
public int hashCode() -
toString
-
of
-
of
-
isValidStaticVersion
Checks if the provided version is a valid static version.- 1.0.0
- 1.0
- 1
- 1.0.0-SNAPSHOT
- 1.0-SNAPSHOT
- 1-SNAPSHOT
- 1.0.0.SNAPSHOT
- 1.0.SNAPSHOT
- 1.SNAPSHOT
- Parameters:
sVersion- The version to check- Returns:
trueif the version is a valid static version,falseif not.
-
parseOrThrow
@Nonnull public static DVRVersion parseOrThrow(@Nullable String sVersion) throws DVRVersionException - Throws:
DVRVersionException
-
parseOrNull
-
getStaticVersionAcceptor
@Nonnull public static Predicate<DVRVersion> getStaticVersionAcceptor(@Nullable Set<String> aVersionsToIgnore, boolean bIncludeSnapshots) Create aPredicatethat can be used to filter static DVR versions. The returned predicate may be used as a filter when iterating over entries. This method is only meant to work with static versions and does not consider pseudo versions.- Parameters:
aVersionsToIgnore- Optional set of specific versions to ignore. This may be handy to explicitly rule out illegal versions. May benullor empty to indicate that no version should be ignored.bIncludeSnapshots-trueif SNAPSHOT versions should be allowed by the resulting predicate.- Returns:
- Never
null.
-