Class Version
- java.lang.Object
-
- fr.paris.lutece.plugins.releaser.util.version.Version
-
- All Implemented Interfaces:
java.lang.Comparable
public class Version extends java.lang.Object implements java.lang.ComparableVersion.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringNOT_AVAILABLEThe Constant NOT_AVAILABLE.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(java.lang.Object object)Compare to.intgetMajor()Gets the major.intgetMinor()Gets the minor.static java.util.List<java.lang.String>getNextReleaseVersions(java.lang.String strPreviousReleaseVersion)Get a list of next versions for a given version.static java.lang.StringgetNextSnapshotVersion(java.lang.String strVersion)Get the next snapshot version for a given version.intgetPatch()Gets the patch.java.lang.StringgetQualifier()Gets the qualifier.static java.lang.StringgetReleaseVersion(java.lang.String strVersion)Get the next release version for a given version.java.lang.StringgetVersion()Gets the version.booleanisBeta()Returns true if the version is qualified as Beta.static booleanisBeta(java.lang.String strVersion)Check if a given version is a RELEASE BETA.booleanisCandidate()Returns true if the version is qualified as Candidate.static booleanisCandidate(java.lang.String strVersion)Check if a given version is a RELEASE CANDIDATE.booleanisSnapshot()Returns true if the version is qualified as Snapshot.static booleanisSnapshot(java.lang.String strVersion)Check if a given version is a SNAPSHOT.VersionnextMajor(boolean bSnapshot)Build a new version object with major digit incremented.VersionnextMinor(boolean bSnapshot)Build a new version object with minor digit incremented.VersionnextPatch(boolean bSnapshot)Build a new version object with patch digit incremented.VersionnextRelease()Build a new version object with no qualifier.static Versionparse(java.lang.String strSource)Parse a string to extract version.voidsetMajor(int nMajor)Sets the major.voidsetMinor(int nMinor)Sets the minor.voidsetPatch(int nPatch)Sets the patch.voidsetQualifier(java.lang.String strQualifier)Sets the qualifier.Versionsnapshot()returns the snapshot version.java.lang.StringtoString().
-
-
-
Field Detail
-
NOT_AVAILABLE
public static final java.lang.String NOT_AVAILABLE
The Constant NOT_AVAILABLE.- See Also:
- Constant Field Values
-
-
Method Detail
-
getMajor
public int getMajor()
Gets the major.- Returns:
- the nMajor
-
setMajor
public void setMajor(int nMajor)
Sets the major.- Parameters:
nMajor- the nMajor to set
-
getMinor
public int getMinor()
Gets the minor.- Returns:
- the nMinor
-
setMinor
public void setMinor(int nMinor)
Sets the minor.- Parameters:
nMinor- the nMinor to set
-
getPatch
public int getPatch()
Gets the patch.- Returns:
- the nPatch
-
setPatch
public void setPatch(int nPatch)
Sets the patch.- Parameters:
nPatch- the nPatch to set
-
getQualifier
public java.lang.String getQualifier()
Gets the qualifier.- Returns:
- the Qualifier
-
setQualifier
public void setQualifier(java.lang.String strQualifier)
Sets the qualifier.- Parameters:
strQualifier- the Qualifier to set
-
compareTo
public int compareTo(java.lang.Object object)
Compare to.- Specified by:
compareToin interfacejava.lang.Comparable- Parameters:
object- the object- Returns:
- the int
-
getVersion
public java.lang.String getVersion()
Gets the version.- Returns:
- the version
-
toString
public java.lang.String toString()
.- Overrides:
toStringin classjava.lang.Object- Returns:
- the string
-
parse
public static Version parse(java.lang.String strSource) throws VersionParsingException
Parse a string to extract version.- Parameters:
strSource- The source- Returns:
- The version object
- Throws:
VersionParsingException- if parsing failed
-
snapshot
public Version snapshot()
returns the snapshot version.- Returns:
- the snapshot version
-
nextMajor
public Version nextMajor(boolean bSnapshot)
Build a new version object with major digit incremented.- Parameters:
bSnapshot- if snapshot qualifier needed- Returns:
- The next version object
-
nextMinor
public Version nextMinor(boolean bSnapshot)
Build a new version object with minor digit incremented.- Parameters:
bSnapshot- if snapshot qualifier needed- Returns:
- The next version object
-
nextPatch
public Version nextPatch(boolean bSnapshot)
Build a new version object with patch digit incremented.- Parameters:
bSnapshot- if snapshot qualifier needed- Returns:
- The next version object
-
nextRelease
public Version nextRelease()
Build a new version object with no qualifier.- Returns:
- The next version object
-
isSnapshot
public boolean isSnapshot()
Returns true if the version is qualified as Snapshot.- Returns:
- true if the version is qualified as Snapshot
-
isCandidate
public boolean isCandidate()
Returns true if the version is qualified as Candidate.- Returns:
- true if the version is qualified as Candidate
-
isBeta
public boolean isBeta()
Returns true if the version is qualified as Beta.- Returns:
- true if the version is qualified as Beta
-
isSnapshot
public static boolean isSnapshot(java.lang.String strVersion)
Check if a given version is a SNAPSHOT.- Parameters:
strVersion- The version to check- Returns:
- True if snapshot otherwise false
-
isCandidate
public static boolean isCandidate(java.lang.String strVersion)
Check if a given version is a RELEASE CANDIDATE.- Parameters:
strVersion- The version to check- Returns:
- True if candidate otherwise false
-
isBeta
public static boolean isBeta(java.lang.String strVersion)
Check if a given version is a RELEASE BETA.- Parameters:
strVersion- The version to check- Returns:
- True if beta otherwise false
-
getNextReleaseVersions
public static java.util.List<java.lang.String> getNextReleaseVersions(java.lang.String strPreviousReleaseVersion)
Get a list of next versions for a given version.- Parameters:
strPreviousReleaseVersion- The current version- Returns:
- The list
-
getNextSnapshotVersion
public static java.lang.String getNextSnapshotVersion(java.lang.String strVersion)
Get the next snapshot version for a given version.- Parameters:
strVersion- The current version- Returns:
- The version
-
getReleaseVersion
public static java.lang.String getReleaseVersion(java.lang.String strVersion)
Get the next release version for a given version.- Parameters:
strVersion- The current version- Returns:
- The version
-
-