|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.myfaces.trinidad.context.Version
public final class Version
Immutable Representation of a dot-separated version.
This representation
allows individual sections of the version to be wild-carded and allows
for comparisons between Versions with different numbers of version
subsections to be compared. When comparing Versions, each version
subsection is compared from left to right. If one Version doesn't have
a version subsection at the current index, the value of versionPadding
is used for this comparison. Version subsections with the wild-card value "*"
are considered equal. The value returned by compareTo() is the value of the
first non-equal version subsection or zero if all subsections match.
Due to the support for wild-cards, this class has a natural ordering
that is inconsistent with equals. For example,
Version("5", "*").compareTo(Version("5.0", "*") == 0
Version("5", "*").equals(Version("5.0", "*") == false;
Constructor Summary | |
---|---|
Version(String version)
Creates a Version instance from the dot-separated Version String using null as the padding |
|
Version(String version,
String versionPadding)
Creates a Version instance from the dot-separated Version String and the versionPadding. |
Method Summary | |
---|---|
int |
compareTo(Version otherVersion)
When comparing Versions, each version subsection is compared from left to right. |
boolean |
equals(Object o)
|
int |
hashCode()
|
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Version(String version)
version
- The dot-separated version to represent
NullPointerException
- if the version is null
IllegalArgumentException
- if the version is an empty StringVersion(String, String)
public Version(String version, String versionPadding)
version
- The dot-separated version to representversionPadding
- The value to return for sub-version sections
requested beyond the sub-version sections present in the version String
NullPointerException
- if version or versionPadding are null
IllegalArgumentException
- if version or versionPadding are the
empty StringMethod Detail |
---|
public int compareTo(Version otherVersion)
compareTo
in interface Comparable<Version>
otherVersion
- The Version object to compare this Version Object with
public String toString()
toString
in class Object
public boolean equals(Object o)
equals
in class Object
public int hashCode()
hashCode
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |