public class SemVer extends Object implements Comparable<SemVer>
getCreator()
pour modifier un de ses elements
Quelques changement par rapport au site:
| Modifier and Type | Class and Description |
|---|---|
static class |
SemVer.SemVerCreator
Construit un objet version, la verification de la coherence est faite lors
de l'appel du create.
|
| Modifier and Type | Field and Description |
|---|---|
protected String |
build |
static String |
BUILD_SEPARATOR
Separateur utiliser devant l'element build
|
static String |
PATTERN_BUILD
pattern pour une partir de l'element build
|
static String |
PATTERN_PRERELEASE
pattern pour une partie de l'element prerelease
|
static String |
PATTERN_VERSION
pattern pour une partie de l'element version
|
protected String |
prerelease |
static String |
PRERELEASE_SEPARATOR
Seperateur entre la version et l'element prerelease
|
static String |
SERIES_SEPARATOR
Separateur utiliser entre chaque element d'une partie
|
protected String |
snapshot |
static String |
SNAPSHOT
la chaine de caractere representant le SNAPSHOT
|
static String |
SNAPSHOT_SEPARATOR
Separateur de SNAPSHOT
|
protected String |
version |
| Constructor and Description |
|---|
SemVer(String versionString)
Create new Version object, strip is done on argument to remove extra space
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
after(SemVer o) |
boolean |
before(SemVer o) |
protected int |
compare(String a,
String b,
boolean nullIsHigh)
Compare deux elements de meme semantique (version, prerelease, build, snapshot)
sinon le comportement est non predictible
|
int |
compareTo(SemVer other) |
static SemVer.SemVerCreator |
creator()
Retourne un Createur sans aucune information.
|
static SemVer.SemVerCreator |
creator(int... v)
Createur qui permet de passer en parametre les different composante de
l'element version
|
static SemVer.SemVerCreator |
creator(SemVer v)
Create creator initialized with SemVer value, you can change some Element
by puting null value.
|
static SemVer.SemVerCreator |
creator(String... v)
Permet de creer un objet version.
|
boolean |
equals(Object o) |
String |
getBuild() |
String |
getBuild(int i)
Retourne un des composants de l'element version
|
int |
getBuildCount()
Donne le nombre de composante de la Prerelease
1.2.3 retourne 3
99.100 retourne 2
|
protected String |
getComposant(String element,
int i)
Retourne un des composants de l'element version
|
protected int |
getComposantCount(String element)
Donne le nombre de composante de l'element
1.2.3 retourne 3
99.100 retourne 2
|
SemVer.SemVerCreator |
getCreator()
Retourne un objet creator initialise avec les donnees de ce SemVer
ce qui permet de creer un nouveau SemVer en modifiant un des elements
|
String |
getMajor() |
String |
getMinor() |
String |
getPatch() |
String |
getPrerelease() |
String |
getPrerelease(int i)
Retourne un des composants de l'element version
|
int |
getPrereleaseCount()
Donne le nombre de composante de la Prerelease
1.2.3 retourne 3
99.100 retourne 2
|
String |
getSnapshot() |
String |
getVersion() |
String |
getVersion(int i)
Retourne un des composants de l'element version
|
int |
getVersionCount()
Donne le nombre de composante de la version
1.2.3 retourne 3
99.100 retourne 2
|
int |
hashCode() |
protected static String |
ifNotNull(String prefix,
String s) |
static boolean |
isSemVer(String version)
Indique si la chaine represente bien une version au format SemVer
|
boolean |
isSnapshot() |
protected int |
nullIsHigh(String a,
String b)
Ne compare par le chaine, seulement la nullite, si un des arguments
est null, alors il est plus grand que l'autre.
|
protected int |
nullIsLow(String a,
String b)
Ne compare par le chaine, seulement la nullite, si un des arguments
est null, alors il est plus petit que l'autre.
|
String |
toJavaIdentifier()
Convertit la representation textuelle de la version en identifiant java valide :
- en java : "-" "." "+" interdit
|
String |
toString() |
public static final String SERIES_SEPARATOR
public static final String PRERELEASE_SEPARATOR
public static final String BUILD_SEPARATOR
public static final String PATTERN_VERSION
public static final String PATTERN_PRERELEASE
public static final String PATTERN_BUILD
public static final String SNAPSHOT_SEPARATOR
public static final String SNAPSHOT
protected String version
protected String prerelease
protected String build
protected String snapshot
public SemVer(String versionString)
versionString - FIXMEIllegalArgumentException - if argument isn't valid version stringpublic boolean before(SemVer o)
o - the other version to testtrue if current version is before the given onepublic boolean after(SemVer o)
o - the other version to testtrue if current version is after the given onepublic int compareTo(SemVer other)
compareTo in interface Comparable<SemVer>protected int compare(String a, String b, boolean nullIsHigh)
a - FIXMEb - FIXMEnullIsHigh - indique si un des elements est null, s'il est plus
grand ou plus petit que l'autreprotected int nullIsHigh(String a, String b)
a - FIXMEb - FIXMEprotected int nullIsLow(String a, String b)
a - FIXMEb - FIXMEprotected int getComposantCount(String element)
element - FIXMEprotected String getComposant(String element, int i)
element - FIXMEi - FIXMEpublic String getVersion()
public int getVersionCount()
public String getVersion(int i)
i - FIXMEpublic String getMajor()
public String getMinor()
public String getPatch()
public String getPrerelease()
public int getPrereleaseCount()
public String getPrerelease(int i)
i - FIXMEpublic String getBuild()
public int getBuildCount()
public String getBuild(int i)
i - FIXMEpublic String getSnapshot()
public boolean isSnapshot()
public String toJavaIdentifier()
public SemVer.SemVerCreator getCreator()
public static boolean isSemVer(String version)
version - FIXMEpublic static SemVer.SemVerCreator creator(String... v)
SemVer v = SemVer.creator().setVersion("1.2").setPrerelease("beta.1").setBuild("r123").done();
SemVer v = SemVer.creator("1.2", "beta.1","r123", SemVer.SNAPSHOT).done();
v - FIXMEpublic static SemVer.SemVerCreator creator(int... v)
v - FIXMEpublic static SemVer.SemVerCreator creator(SemVer v)
v - FIXMEpublic static SemVer.SemVerCreator creator()
Copyright © 2016 CodeLutin. All rights reserved.