|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.codehaus.mojo.pomtools.versioning.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 static java.util.regex.Pattern |
DATESTAMP_PATTERN
|
static java.lang.String[] |
DEFAULT_ANNOTATION_ORDER
Default order of annotations to consider in compareTo(Object) . |
protected static java.util.regex.Pattern |
DIGIT_SEPARATOR_PATTERN
|
protected static java.lang.String |
DIGIT_SEPARATOR_STRING
|
protected static java.util.regex.Pattern |
OPTIONAL_DIGIT_SEPARATOR_PATTERN
|
static java.lang.String |
SNAPSHOT_IDENTIFIER
|
protected static java.util.regex.Pattern |
STANDARD_PATTERN
|
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. |
boolean |
equals(java.lang.Object obj)
|
java.lang.String |
getAnnotation()
|
java.util.List |
getAnnotationOrder()
|
java.lang.String |
getAnnotationRevision()
|
org.apache.maven.artifact.versioning.ArtifactVersion |
getArtifactVersion()
|
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)
|
int |
hashCode()
|
protected java.lang.String |
incrementVersionString(java.lang.String s)
Takes a string and increments it as an integer. |
boolean |
isParsed()
|
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)
|
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String SNAPSHOT_IDENTIFIER
protected static final java.lang.String DIGIT_SEPARATOR_STRING
public static final java.lang.String[] DEFAULT_ANNOTATION_ORDER
compareTo(Object)
.
null
denotes a version without an annotation. Therefore, a "SP"
or Service Pack build is considered to be greater than a version without
an annotation.
protected static final java.util.regex.Pattern DATESTAMP_PATTERN
protected static final java.util.regex.Pattern STANDARD_PATTERN
protected static final java.util.regex.Pattern OPTIONAL_DIGIT_SEPARATOR_PATTERN
protected static final java.util.regex.Pattern DIGIT_SEPARATOR_PATTERN
Constructor Detail |
---|
public DefaultVersionInfo(java.lang.String version)
version
- Method Detail |
---|
protected void parseVersion(java.lang.String version)
version
- public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public boolean isParsed()
isParsed
in interface VersionInfo
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 org.apache.maven.artifact.versioning.ArtifactVersion getArtifactVersion()
getArtifactVersion
in interface VersionInfo
public java.lang.String toString()
toString
in class java.lang.Object
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 |