Class AbstractVersion
- java.lang.Object
-
- com.github.toolarium.common.version.AbstractVersion
-
- Direct Known Subclasses:
SemanticVersion,Version
public abstract class AbstractVersion extends java.lang.ObjectThe version base class
-
-
Constructor Summary
Constructors Constructor Description AbstractVersion(java.lang.String originalVersion, VersionType inputVersionType)Constructor for AbstractVersion
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object o)protected java.lang.StringgetOriginalVersion()Get the original versionVersionTypegetType()Get the versoon typeinthashCode()protected java.lang.IntegerparseInteger(VersionType versionType, java.lang.String[] value, int idx, java.lang.String errorDetailMessage)Parse an integerprotected java.lang.StringprepareVersionString(VersionType versionType, java.lang.String inputVersion)Prepare the versionprotected static VersionTypeselectVersionType(VersionType inputVersionType)Select the version typeprotected voidthrowInvalidVersion(boolean isTrue, java.lang.String errorDetailMessage)Throws an illegal argument exception if the expression is truejava.lang.StringtoString()
-
-
-
Constructor Detail
-
AbstractVersion
public AbstractVersion(java.lang.String originalVersion, VersionType inputVersionType)Constructor for AbstractVersion- Parameters:
originalVersion- the original versioninputVersionType- the version type
-
-
Method Detail
-
getType
public VersionType getType()
Get the versoon type- Returns:
- the versoon type
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object- See Also:
Object.equals(java.lang.Object)
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object- See Also:
Object.hashCode()
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object- See Also:
Object.toString()
-
getOriginalVersion
protected java.lang.String getOriginalVersion()
Get the original version- Returns:
- the original version
-
selectVersionType
protected static VersionType selectVersionType(VersionType inputVersionType)
Select the version type- Parameters:
inputVersionType- the input version type- Returns:
- the version type
-
prepareVersionString
protected java.lang.String prepareVersionString(VersionType versionType, java.lang.String inputVersion) throws java.lang.IllegalArgumentException
Prepare the version- Parameters:
versionType- the version typeinputVersion- the input version- Returns:
- prepared version
- Throws:
java.lang.IllegalArgumentException- the exception which will be thrown of an invalid input
-
parseInteger
protected java.lang.Integer parseInteger(VersionType versionType, java.lang.String[] value, int idx, java.lang.String errorDetailMessage) throws java.lang.IllegalArgumentException
Parse an integer- Parameters:
versionType- the version typevalue- the valueidx- the indexerrorDetailMessage- the error detail message or null- Returns:
- the parsed index
- Throws:
java.lang.IllegalArgumentException- the exception which will be thrown of an invalid input
-
throwInvalidVersion
protected void throwInvalidVersion(boolean isTrue, java.lang.String errorDetailMessage) throws java.lang.IllegalArgumentExceptionThrows an illegal argument exception if the expression is true- Parameters:
isTrue- the expressionerrorDetailMessage- the detail message or null- Throws:
java.lang.IllegalArgumentException- the exception which will be thrown
-
-