|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.nuiton.util.Version
public class Version
A class to represent an application version with possible classifier.
Replace previously org.nuiton.util.VersionNumber class. Simple version number is defined like this :1.0.0 or 1A version can be more complex, with a classifier like this :
1.0.0-alpha-1, 1.0.0-beta-2, 1.0.0-rc-1A classifier (alpha, beta, rc, ...) must be follwed by a classifier number. Note : - initial value is 0 - the equals order is defined on
getVersion() property.
- the class is comparable, using the natural version order :
0 < 0.1 < 1 < 1.0 < 1.1-alpha-0 < 1.1-alpha-1 < 1.1-beta-0 <
1.1-rc-1 < 1.1
- the class is immutable, you should not instanciate directly a Version,
but prefer use the factory static methods
VersionUtil.valueOf(...) instead.
| Field Summary | |
|---|---|
protected String |
classifier
optional classifier |
protected Integer |
classifierNumber
optional classifier number (if no classifier should be null) |
protected boolean |
classifierNumberAttached
A flag to attach or not the classifier with his number. |
protected int[] |
numbers
main numbers of the version |
protected boolean |
snapshot
boolean to define if version is a snapshot (if so a -SNAPSHOT is added at the end of the textual representation of the version). |
protected String |
version
representation textuelle de la version (celle utilisee dans le toString(). |
static Version |
VZERO
Version V0 |
| Constructor Summary | |
|---|---|
Version()
Constructeur par defaut, definit la version par defaut, i.e 0 |
|
Version(int... numbers)
Constructeur d'une version simple (sans classifier). |
|
Version(String version)
Constructeur de version a partir de sa representation textuelle |
|
Version(String classifier,
Integer classiferNumber,
boolean snapshot,
int... numbers)
Constructeur d'une version (simple ou avec classifier) |
|
Version(String classifier,
Integer classiferNumber,
int... numbers)
Constructeur d'une version (simple ou avec classifier) |
|
| Method Summary | |
|---|---|
boolean |
after(Version o)
|
boolean |
before(Version o)
|
int |
compareTo(Version o)
|
boolean |
equals(Object obj)
|
String |
getClassifier()
|
Integer |
getClassifierNumber()
|
int |
getNbComponents()
|
int |
getNumber(int level)
|
int[] |
getNumbers()
|
String |
getValidName()
Convertit la representation textuelle de la version en identifiant java valide : - en java : "." interdit - en mysql, h2 ... : "." interdit |
String |
getVersion()
|
boolean |
hasClassifier()
|
int |
hashCode()
|
boolean |
isClassifierNumberAttached()
|
boolean |
isSnapshot()
|
void |
setClassifierNumberAttached(boolean classifierNumberAttached)
Change the internal state classifierNumberAttached. |
String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final Version VZERO
protected final String classifier
protected final Integer classifierNumber
protected final int[] numbers
protected final boolean snapshot
protected boolean classifierNumberAttached
Version class is immutable, this state can be change
since it is only used to build the string representation of a version.
Notes that this state is NOT used to test equality of two version,
neither for the comparaison.
protected transient String version
toString().
| Constructor Detail |
|---|
public Version()
public Version(int... numbers)
numbers - les nombres de la version
public Version(String classifier,
Integer classiferNumber,
int... numbers)
classifier - le classifier (peut-ĂȘtre null)classiferNumber - la version du classifier (doit etre null si le
classifier est null)numbers - les nombres de la version
public Version(String classifier,
Integer classiferNumber,
boolean snapshot,
int... numbers)
classifier - le classifier (peut-ĂȘtre null)classiferNumber - la version du classifier (doit etre null si le
classifier est null)snapshot - boolean pour renseigner le champ snapshot.numbers - les nombres de la version
public Version(String version)
throws IllegalArgumentException
version - la represention de la version a instancier
IllegalArgumentException - si la version n'est pas valide| Method Detail |
|---|
public int[] getNumbers()
public String getClassifier()
public boolean hasClassifier()
public Integer getClassifierNumber()
public boolean isSnapshot()
public int getNbComponents()
public boolean isClassifierNumberAttached()
public int getNumber(int level)
public String getVersion()
public String getValidName()
public void setClassifierNumberAttached(boolean classifierNumberAttached)
classifierNumberAttached.
classifierNumberAttached - the new value of the classifierNumberAttached statepublic String toString()
toString in class Objectpublic int compareTo(Version o)
compareTo in interface Comparable<Version>public boolean before(Version o)
o - the other version to test
true if current version is before the given onepublic boolean after(Version o)
o - the other version to test
true if current version is after the given onepublic boolean equals(Object obj)
equals in class Objectpublic int hashCode()
hashCode in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||