Class SemanticVersion


  • public class SemanticVersion
    extends java.lang.Object
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static SemanticVersion ZERO
      Creates an instance with all version numbers set to zero.
    • Constructor Summary

      Constructors 
      Constructor Description
      SemanticVersion​(int major, int minor, int patch)  
      SemanticVersion​(int major, int minor, int patch, java.lang.String additional)  
    • Field Detail

      • ZERO

        public static final SemanticVersion ZERO
        Creates an instance with all version numbers set to zero.
    • Constructor Detail

      • SemanticVersion

        public SemanticVersion​(int major,
                               int minor,
                               int patch,
                               java.lang.String additional)
      • SemanticVersion

        public SemanticVersion​(int major,
                               int minor,
                               int patch)
    • Method Detail

      • fromString

        public static SemanticVersion fromString​(java.lang.String versionString)
                                          throws java.lang.NumberFormatException
        Creates an instance using a Version-String in the form MAJOR.MINOR.PATCH-ADDITIONAL, like "2019.2.1-SNAPSHOT".
        Parameters:
        versionString - the Version-String
        Returns:
        the SemanticVersion instance
        Throws:
        java.lang.NumberFormatException - on parse error
      • fromStringOrZero

        public static SemanticVersion fromStringOrZero​(java.lang.String versionString)
        Creates an instance using a Version-String in the form MAJOR.MINOR.PATCH-ADDITIONAL, like "2019.2.1-SNAPSHOT". On Error a ZERO version is returned - avoiding an exception.
        Parameters:
        versionString - the Version-String
        Returns:
        the SemanticVersion instance
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object