public class DefaultVersionInfo extends java.lang.Object implements VersionInfo
component-digits-annotation-annotationRevision-buildSpecifier
my-component-1.0.1-alpha-2-SNAPSHOT
log4j-1.2.9-beta-9-SNAPSHOT == log4j1.2.9beta9SNAPSHOT == log4j_1.2.9_beta_9_SNAPSHOT
Leading zeros are significant when performing comparisons.
TODO: this parser is better than DefaultArtifactVersion - replace it with this (but align naming) and then remove this from here.Modifier and Type | Field and Description |
---|---|
static java.util.regex.Pattern |
ALTERNATE_PATTERN |
private java.lang.String |
annotation |
private static int |
ANNOTATION_INDEX |
private static int |
ANNOTATION_REV_SEPARATOR_INDEX |
private static int |
ANNOTATION_REVISION_INDEX |
private static int |
ANNOTATION_SEPARATOR_INDEX |
private java.lang.String |
annotationRevision |
private java.lang.String |
annotationRevSeparator |
private java.lang.String |
annotationSeparator |
private static int |
BUILD_SEPARATOR_INDEX |
private static int |
BUILD_SPECIFIER_INDEX |
private java.lang.String |
buildSeparator |
private java.lang.String |
buildSpecifier |
private static java.lang.String |
DIGIT_SEPARATOR_STRING |
private java.util.List<java.lang.String> |
digits |
private static int |
DIGITS_INDEX |
private static java.lang.String |
SNAPSHOT_IDENTIFIER |
static java.util.regex.Pattern |
STANDARD_PATTERN |
private java.lang.String |
strVersion |
Constructor and Description |
---|
DefaultVersionInfo(java.util.List<java.lang.String> digits,
java.lang.String annotation,
java.lang.String annotationRevision,
java.lang.String buildSpecifier,
java.lang.String annotationSeparator,
java.lang.String annotationRevSeparator,
java.lang.String buildSeparator) |
DefaultVersionInfo(java.lang.String version)
Constructs this object and parses the supplied version string.
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(VersionInfo obj)
Compares this
DefaultVersionInfo to the supplied DefaultVersionInfo
to determine which version is greater. |
boolean |
equals(java.lang.Object obj) |
java.lang.String |
getAnnotation() |
java.lang.String |
getAnnotationRevision() |
java.lang.String |
getBuildSpecifier() |
java.util.List<java.lang.String> |
getDigits() |
VersionInfo |
getNextVersion()
Returns a
VersionInfo object which represents the next version of this object. |
java.lang.String |
getReleaseVersionString()
Returns a string representing the version without a snapshot specification.
|
java.lang.String |
getSnapshotVersionString()
Returns a string representing the version with a snapshot specification
|
protected static java.lang.String |
getVersionString(DefaultVersionInfo info,
java.lang.String buildSpecifier,
java.lang.String buildSeparator) |
protected java.lang.String |
incrementVersionString(java.lang.String s)
Takes a string and increments it as an integer.
|
boolean |
isSnapshot()
Returns whether this represents a snapshot version.
|
protected static java.lang.String |
joinDigitString(java.util.List<java.lang.String> digits)
Simply joins the items in the list with "." period
|
private static java.lang.String |
nullIfEmpty(java.lang.String s) |
private java.util.List<java.lang.String> |
parseDigits(java.lang.String strDigits)
Splits the string on "." and returns a list
containing each digit.
|
java.lang.String |
toString() |
private final java.lang.String strVersion
private final java.util.List<java.lang.String> digits
private java.lang.String annotation
private java.lang.String annotationRevision
private final java.lang.String buildSpecifier
private java.lang.String annotationSeparator
private java.lang.String annotationRevSeparator
private final java.lang.String buildSeparator
private static final int DIGITS_INDEX
private static final int ANNOTATION_SEPARATOR_INDEX
private static final int ANNOTATION_INDEX
private static final int ANNOTATION_REV_SEPARATOR_INDEX
private static final int ANNOTATION_REVISION_INDEX
private static final int BUILD_SEPARATOR_INDEX
private static final int BUILD_SPECIFIER_INDEX
private static final java.lang.String SNAPSHOT_IDENTIFIER
private static final java.lang.String DIGIT_SEPARATOR_STRING
public static final java.util.regex.Pattern STANDARD_PATTERN
public static final java.util.regex.Pattern ALTERNATE_PATTERN
public DefaultVersionInfo(java.lang.String version) throws VersionParseException
version
- VersionParseException
public DefaultVersionInfo(java.util.List<java.lang.String> digits, java.lang.String annotation, java.lang.String annotationRevision, java.lang.String buildSpecifier, java.lang.String annotationSeparator, java.lang.String annotationRevSeparator, java.lang.String buildSeparator)
public boolean isSnapshot()
VersionInfo
isSnapshot
in interface VersionInfo
public VersionInfo getNextVersion()
VersionInfo
VersionInfo
object which represents the next version of this object.getNextVersion
in interface VersionInfo
public int compareTo(VersionInfo obj)
DefaultVersionInfo
to the supplied DefaultVersionInfo
to determine which version is greater.compareTo
in interface java.lang.Comparable<VersionInfo>
obj
- the comparison versionjava.lang.IllegalArgumentException
- if the components differ between the objects or if either of the annotations can not be determined.public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
protected java.lang.String incrementVersionString(java.lang.String s)
s
- public java.lang.String getSnapshotVersionString()
VersionInfo
getSnapshotVersionString
in interface VersionInfo
public java.lang.String getReleaseVersionString()
VersionInfo
getReleaseVersionString
in interface VersionInfo
public java.lang.String toString()
toString
in class java.lang.Object
protected static java.lang.String getVersionString(DefaultVersionInfo info, java.lang.String buildSpecifier, java.lang.String buildSeparator)
protected static java.lang.String joinDigitString(java.util.List<java.lang.String> digits)
digits
- private java.util.List<java.lang.String> parseDigits(java.lang.String strDigits)
strDigits
- private static java.lang.String nullIfEmpty(java.lang.String s)
public java.util.List<java.lang.String> getDigits()
public java.lang.String getAnnotation()
public java.lang.String getAnnotationRevision()
public java.lang.String getBuildSpecifier()