Class AbstractVersion
java.lang.Object
com.github.toolarium.common.version.AbstractVersion
- Direct Known Subclasses:
SemanticVersion,Version
The version base class
-
Constructor Summary
ConstructorsConstructorDescriptionAbstractVersion(String originalVersion, VersionType inputVersionType) Constructor for AbstractVersion -
Method Summary
Modifier and TypeMethodDescriptionbooleanprotected StringGet the original versiongetType()Get the versoon typeinthashCode()protected IntegerparseInteger(VersionType versionType, String[] value, int idx, String errorDetailMessage) Parse an integerprotected StringprepareVersionString(VersionType versionType, String inputVersion) Prepare the versionprotected static VersionTypeselectVersionType(VersionType inputVersionType) Select the version typeprotected voidthrowInvalidVersion(boolean isTrue, String errorDetailMessage) Throws an illegal argument exception if the expression is truetoString()
-
Constructor Details
-
AbstractVersion
Constructor for AbstractVersion- Parameters:
originalVersion- the original versioninputVersionType- the version type
-
-
Method Details
-
getType
Get the versoon type- Returns:
- the versoon type
-
equals
-
hashCode
public int hashCode() -
toString
-
getOriginalVersion
Get the original version- Returns:
- the original version
-
selectVersionType
Select the version type- Parameters:
inputVersionType- the input version type- Returns:
- the version type
-
prepareVersionString
protected String prepareVersionString(VersionType versionType, String inputVersion) throws IllegalArgumentException Prepare the version- Parameters:
versionType- the version typeinputVersion- the input version- Returns:
- prepared version
- Throws:
IllegalArgumentException- the exception which will be thrown of an invalid input
-
parseInteger
protected Integer parseInteger(VersionType versionType, String[] value, int idx, String errorDetailMessage) throws IllegalArgumentException Parse an integer- Parameters:
versionType- the version typevalue- the valueidx- the indexerrorDetailMessage- the error detail message or null- Returns:
- the parsed index
- Throws:
IllegalArgumentException- the exception which will be thrown of an invalid input
-
throwInvalidVersion
protected void throwInvalidVersion(boolean isTrue, String errorDetailMessage) throws IllegalArgumentException Throws an illegal argument exception if the expression is true- Parameters:
isTrue- the expressionerrorDetailMessage- the detail message or null- Throws:
IllegalArgumentException- the exception which will be thrown
-