public class DefaultVersionInfo extends Object implements VersionInfo
The supported version scheme has the following parts.
component-digits-annotation-annotationRevision-buildSpecifier
Example:
my-component-1.0.1-alpha-2-SNAPSHOT
Terms:
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 Pattern |
ALTERNATE_PATTERN
Constant
ALTERNATE_PATTERN |
static Pattern |
STANDARD_PATTERN
Constant
STANDARD_PATTERN |
Constructor and Description |
---|
DefaultVersionInfo(List<String> digits,
String annotation,
String annotationRevision,
String buildSpecifier,
String annotationSeparator,
String annotationRevSeparator,
String buildSeparator)
Constructor for DefaultVersionInfo.
|
DefaultVersionInfo(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(Object obj) |
String |
getAnnotation()
Getter for the field
annotation . |
String |
getAnnotationRevision()
Getter for the field
annotationRevision . |
String |
getBuildSpecifier()
Getter for the field
buildSpecifier . |
List<String> |
getDigits()
Getter for the field
digits . |
VersionInfo |
getNextVersion()
Returns a
VersionInfo object which represents the next version
of this object. |
String |
getReleaseVersionString()
Returns a string representing the version without a snapshot specification.
|
String |
getSnapshotVersionString()
Returns a string representing the version with a snapshot specification
|
protected static String |
getVersionString(DefaultVersionInfo info,
String buildSpecifier,
String buildSeparator)
getVersionString.
|
int |
hashCode() |
protected String |
incrementVersionString(String s)
Takes a string and increments it as an integer.
|
boolean |
isSnapshot()
Returns whether this represents a snapshot version.
|
protected static String |
joinDigitString(List<String> digits)
Simply joins the items in the list with "." period
|
String |
toString() |
public static final Pattern STANDARD_PATTERN
STANDARD_PATTERN
public static final Pattern ALTERNATE_PATTERN
ALTERNATE_PATTERN
public DefaultVersionInfo(String version) throws VersionParseException
version
- the version stringVersionParseException
- if an exception during parsing the inputpublic boolean isSnapshot()
VersionInfo
isSnapshot
in interface VersionInfo
true
if the original value was a snapshot, otherwise false
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 Comparable<VersionInfo>
protected String incrementVersionString(String s)
s
- the version numberString
increments the input String
as an integer
and Preserves any lpad of "0" zeros.public String getSnapshotVersionString()
VersionInfo
getSnapshotVersionString
in interface VersionInfo
public String getReleaseVersionString()
VersionInfo
getReleaseVersionString
in interface VersionInfo
protected static String getVersionString(DefaultVersionInfo info, String buildSpecifier, String buildSeparator)
getVersionString.
info
- a DefaultVersionInfo
objectbuildSpecifier
- a String
objectbuildSeparator
- a String
objectString
objectprotected static String joinDigitString(List<String> digits)
digits
- List<String>
of digitsString
of the items in the passed list, joined with a "."public String getAnnotation()
Getter for the field annotation
.
String
objectpublic String getAnnotationRevision()
Getter for the field annotationRevision
.
String
objectCopyright © 2002–2024 The Apache Software Foundation. All rights reserved.