|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.maven.plugins.release.versions.DefaultVersionInfo
public class DefaultVersionInfo
This compares and increments versions for a common java versioning scheme.
The supported version scheme has the following parts.
component-digits-annotation-annotationRevision-buildSpecifier
Example:
my-component-1.0.1-alpha-2-SNAPSHOT
setAnnotationOrder(List)
to change the valid values.
Implementation details:
The separators "_" and "-" between components are also optional (though they are usually reccommended).
Example:
log4j-1.2.9-beta-9-SNAPSHOT == log4j1.2.9beta9SNAPSHOT == log4j_1.2.9_beta_9_SNAPSHOT
All numbers in the "digits" part of the version are considered Integers. Therefore 1.01.01 is the same as 1.1.1 Leading zeros are ignored when performing comparisons.
Field Summary | |
---|---|
protected java.lang.String |
annotation
|
protected java.util.List |
annotationOrder
|
protected java.lang.String |
annotationRevision
|
protected java.lang.String |
annotationRevSeparator
|
protected java.lang.String |
annotationSeparator
|
protected java.lang.String |
buildSeparator
|
protected java.lang.String |
buildSpecifier
|
protected java.lang.String |
component
|
protected static java.util.regex.Pattern |
DIGIT_SEPARATOR_PATTERN
|
protected static java.lang.String |
DIGIT_SEPARATOR_STRING
|
protected java.util.List |
digits
|
protected java.lang.String |
digitSeparator
|
static java.lang.String |
SNAPSHOT_IDENTIFIER
|
protected static java.util.regex.Pattern |
STANDARD_PATTERN
|
protected java.lang.String |
strVersion
|
Constructor Summary | |
---|---|
DefaultVersionInfo(java.lang.String version)
Constructs this object and parses the supplied version string. |
Method Summary | |
---|---|
int |
compareTo(java.lang.Object obj)
Compares this DefaultVersionInfo to the supplied DefaultVersionInfo
to determine which version is greater. |
java.lang.String |
getAnnotation()
|
java.util.List |
getAnnotationOrder()
|
java.lang.String |
getAnnotationRevision()
|
java.lang.String |
getBuildSpecifier()
|
java.lang.String |
getComponent()
|
java.util.List |
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 |
java.lang.String |
getVersionString()
Returns a string representing the version without modification. |
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 digits)
Simply joins the items in the list with "." period |
protected java.util.List |
parseDigits(java.lang.String strDigits)
Splits the string on "." and returns a list containing each digit. |
protected void |
parseVersion(java.lang.String version)
Internal routine for parsing the supplied version string into its parts. |
protected void |
setAnnotation(java.lang.String annotation)
|
protected void |
setAnnotationOrder(java.util.List annotationOrder)
|
protected void |
setAnnotationRevision(java.lang.String annotationRevision)
|
protected void |
setBuildSpecifier(java.lang.String buildSpecifier)
|
protected void |
setComponent(java.lang.String component)
|
protected void |
setDigits(java.util.List digits)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.lang.String strVersion
protected java.lang.String component
protected java.util.List digits
protected java.lang.String annotation
protected java.lang.String annotationRevision
protected java.lang.String buildSpecifier
protected java.lang.String digitSeparator
protected java.lang.String annotationSeparator
protected java.lang.String annotationRevSeparator
protected java.lang.String buildSeparator
protected java.util.List annotationOrder
public static final java.lang.String SNAPSHOT_IDENTIFIER
protected static final java.lang.String DIGIT_SEPARATOR_STRING
protected static final java.util.regex.Pattern STANDARD_PATTERN
protected static final java.util.regex.Pattern DIGIT_SEPARATOR_PATTERN
Constructor Detail |
---|
public DefaultVersionInfo(java.lang.String version) throws VersionParseException
version
-
VersionParseException
Method Detail |
---|
protected void parseVersion(java.lang.String version) throws VersionParseException
version
-
VersionParseException
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(java.lang.Object obj)
DefaultVersionInfo
to the supplied DefaultVersionInfo
to determine which version is greater.
Decision order is: digits, annotation, annotationRev, buildSpecifier.
Presence of an annotation is considered to be less than an equivalent version without an annotation.
Example: 1.0 is greater than 1.0-alpha.
The getAnnotationOrder()
is used in determining the rank order of annotations.
For example: alpha < beta < RC < release
compareTo
in interface java.lang.Comparable
that
-
java.lang.IllegalArgumentException
- if the components differ between the objects or if either of the annotations can not be determined.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 getVersionString()
VersionInfo
getVersionString
in interface VersionInfo
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 digits)
digits
-
protected java.util.List parseDigits(java.lang.String strDigits)
strDigits
-
public java.lang.String getAnnotation()
protected void setAnnotation(java.lang.String annotation)
public java.lang.String getAnnotationRevision()
protected void setAnnotationRevision(java.lang.String annotationRevision)
public java.lang.String getComponent()
protected void setComponent(java.lang.String component)
public java.util.List getDigits()
protected void setDigits(java.util.List digits)
public java.lang.String getBuildSpecifier()
protected void setBuildSpecifier(java.lang.String buildSpecifier)
public java.util.List getAnnotationOrder()
protected void setAnnotationOrder(java.util.List annotationOrder)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |