Class AbstractVersion

  • Direct Known Subclasses:
    SemanticVersion, Version

    public abstract class AbstractVersion
    extends java.lang.Object
    The version base class
    • Constructor Detail

      • AbstractVersion

        public AbstractVersion​(java.lang.String originalVersion,
                               VersionType inputVersionType)
        Constructor for AbstractVersion
        Parameters:
        originalVersion - the original version
        inputVersionType - 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:
        equals in class java.lang.Object
        See Also:
        Object.equals(java.lang.Object)
      • hashCode

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

        public java.lang.String toString()
        Overrides:
        toString in class java.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 type
        inputVersion - 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 type
        value - the value
        idx - the index
        errorDetailMessage - 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.IllegalArgumentException
        Throws an illegal argument exception if the expression is true
        Parameters:
        isTrue - the expression
        errorDetailMessage - the detail message or null
        Throws:
        java.lang.IllegalArgumentException - the exception which will be thrown