Class AbstractVersion

java.lang.Object
com.github.toolarium.common.version.AbstractVersion
Direct Known Subclasses:
SemanticVersion, Version

public abstract class AbstractVersion extends Object
The version base class
  • Constructor Details

    • AbstractVersion

      public AbstractVersion(String originalVersion, VersionType inputVersionType)
      Constructor for AbstractVersion
      Parameters:
      originalVersion - the original version
      inputVersionType - the version type
  • Method Details

    • getType

      public VersionType getType()
      Get the versoon type
      Returns:
      the versoon type
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
      See Also:
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
      See Also:
    • toString

      public String toString()
      Overrides:
      toString in class Object
      See Also:
    • getOriginalVersion

      protected 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 String prepareVersionString(VersionType versionType, String inputVersion) throws IllegalArgumentException
      Prepare the version
      Parameters:
      versionType - the version type
      inputVersion - 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 type
      value - the value
      idx - the index
      errorDetailMessage - 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 expression
      errorDetailMessage - the detail message or null
      Throws:
      IllegalArgumentException - the exception which will be thrown