public class Version extends Object implements Comparable<Version>, Serializable
org.nuiton.util.Version class.
componants separated by componantSeparator.
empty character.
Componant separators are optional and componants will be detected as soon as a character changed from a numeric string sequence to a alpha (none numeric!) sequence.
For example, version 1a2 is composed of three componants: {code 1}, a and 3.
SNAPSHOT (see below section about ordering).
0 (one componant 0) 0-SNAPSHOT (one componant 0 + SNAPSHOT flag) 1.0 (two componants 1,0) 1.1 (two componants 1,1) 1.1-alpha-1 (four componants 1,1,alpha,1) 1.1-beta (three componants 1,1,beta) 1.1-rc-1 (four componants 1,1,rc,1) 1.1-a (three componants 1,1,a) 1.1-a12-4.45_6432 (seven componants 1,1,a,12,4,45,643)
VersionComparator.
VersionBuilder API or the internal methods
VersionBuilder,
VersionComparator,
Serialized Form| Modifier and Type | Class and Description |
|---|---|
static class |
Version.NumberVersionComponant |
static class |
Version.StringVersionComponant |
static interface |
Version.VersionComponant<C extends Comparable<C>,V extends Version.VersionComponant> |
| Modifier and Type | Field and Description |
|---|---|
protected List<Version.VersionComponant> |
componants
List of componants of the version.
|
protected List<String> |
componantSeparators
List of separators of the version.
|
static char |
DEFAULT_JOIN_COMPONANT_SEPARATOR |
protected boolean |
snapshot
flag to define if version is a snapshot (if so a -SNAPSHOT is
added at the end of the textual representation of the version).
|
static String |
SNAPSHOT_SUFFIX
Suffix of a
SNAPSHOT version in the text representation. |
protected String |
version
string represention of the version.
|
protected static VersionComparator |
VERSION_COMPARATOR
Comparator of version used internaly to fulfill the compoarator contract.
|
static Version |
VZERO
Version V0.
|
| Modifier | Constructor and Description |
|---|---|
protected |
Version(List<Version.VersionComponant> componants,
List<String> componantSeparators,
boolean snapshot) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
after(Version o) |
boolean |
before(Version o) |
int |
compareTo(Version o) |
Version |
decrements(int componantPosition)
Creates a new version from this one with the number componant decremented at the given position.
|
boolean |
equals(Object o) |
String |
getClassifierComponant(int componantPosition) |
protected Version.VersionComponant |
getComponant(int level) |
int |
getComponantCount() |
List<Version.VersionComponant> |
getComponants() |
List<String> |
getComponantSeparators() |
protected Version.VersionComponant |
getLastComponant() |
int |
getNumberComponant(int componantPosition) |
String |
getValidName()
Convert the string representation to a java identifier compliant.
|
String |
getVersion() |
int |
hashCode() |
Version |
increments()
Creates a new version from this one incremented.
|
Version |
increments(char componantSeperator)
Creates a new version from this one incremented.
|
Version |
increments(int componantPosition)
Creates a new version from this one with the number componant incremented at the given position.
|
boolean |
isSnapshot() |
String |
toString() |
public static final String SNAPSHOT_SUFFIX
SNAPSHOT version in the text representation.public static final Version VZERO
protected static final VersionComparator VERSION_COMPARATOR
public static final char DEFAULT_JOIN_COMPONANT_SEPARATOR
protected final List<Version.VersionComponant> componants
protected final List<String> componantSeparators
protected final boolean snapshot
protected transient String version
protected Version(List<Version.VersionComponant> componants, List<String> componantSeparators, boolean snapshot)
public List<Version.VersionComponant> getComponants()
public boolean isSnapshot()
public int getComponantCount()
public int getNumberComponant(int componantPosition)
public String getClassifierComponant(int componantPosition)
public String getVersion()
public String getValidName()
. is forbidden. is forbidden_ character.public Version increments()
public Version increments(char componantSeperator)
componantSeperator - the componant separator to use the last componant is a classifierpublic Version increments(int componantPosition)
componantPosition - position of the version componant to incrementpublic Version decrements(int componantPosition)
componantPosition - position of the version componant to incrementpublic int compareTo(Version o)
compareTo in interface Comparable<Version>public boolean before(Version o)
o - the other version to testtrue if current version is before the given onepublic boolean after(Version o)
o - the other version to testtrue if current version is after the given oneprotected Version.VersionComponant getComponant(int level)
protected Version.VersionComponant getLastComponant()
Copyright © 2004–2014 CodeLutin. All rights reserved.