Class Version
- java.lang.Object
-
- fr.paris.lutece.plugins.releaser.util.version.Version
-
- All Implemented Interfaces:
Comparable
public class Version extends Object implements Comparable
Version.
-
-
Field Summary
Fields Modifier and Type Field Description static StringNOT_AVAILABLEThe Constant NOT_AVAILABLE.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(Object object)Compare to.intgetMajor()Gets the major.intgetMinor()Gets the minor.static List<String>getNextReleaseVersions(String strPreviousReleaseVersion)Get a list of next versions for a given version.static StringgetNextSnapshotVersion(String strVersion)Get the next snapshot version for a given version.intgetPatch()Gets the patch.StringgetQualifier()Gets the qualifier.static StringgetReleaseVersion(String strVersion)Get the next release version for a given version.StringgetVersion()Gets the version.booleanisCandidate()Returns true if the version is qualified as Candidate.static booleanisCandidate(String strVersion)Check if a given version is a RELEASE CANDIDATE.booleanisSnapshot()Returns true if the version is qualified as Snapshot.static booleanisSnapshot(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(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(String strQualifier)Sets the qualifier.Versionsnapshot()returns the snapshot version.StringtoString().
-
-
-
Field Detail
-
NOT_AVAILABLE
public static final String NOT_AVAILABLE
The Constant NOT_AVAILABLE.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
Version
public Version()
Constructor.
-
Version
public Version(int nMajor, int nMinor, int nPatch, String strQualifier)Constructor.- Parameters:
nMajor- major digitnMinor- minor digitnPatch- patch digitstrQualifier- qualifier
-
-
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 String getQualifier()
Gets the qualifier.- Returns:
- the Qualifier
-
setQualifier
public void setQualifier(String strQualifier)
Sets the qualifier.- Parameters:
strQualifier- the Qualifier to set
-
compareTo
public int compareTo(Object object)
Compare to.- Specified by:
compareToin interfaceComparable- Parameters:
object- the object- Returns:
- the int
-
getVersion
public String getVersion()
Gets the version.- Returns:
- the version
-
parse
public static Version parse(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
-
isSnapshot
public static boolean isSnapshot(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(String strVersion)
Check if a given version is a RELEASE CANDIDATE.- Parameters:
strVersion- The version to check- Returns:
- True if candidate otherwise false
-
getNextReleaseVersions
public static List<String> getNextReleaseVersions(String strPreviousReleaseVersion)
Get a list of next versions for a given version.- Parameters:
strPreviousReleaseVersion- The current version- Returns:
- The list
-
getNextSnapshotVersion
public static String getNextSnapshotVersion(String strVersion)
Get the next snapshot version for a given version.- Parameters:
strVersion- The current version- Returns:
- The version
-
-