Class SemanticVersion

    • Constructor Detail

      • SemanticVersion

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

      • getMajor

        public int getMajor()
      • getMinor

        public int getMinor()
      • getPatch

        public int getPatch()
      • getPreRelease

        public String getPreRelease()
      • getPreReleaseComponents

        public String[] getPreReleaseComponents()
      • getBuild

        public String getBuild()
      • parse

        public static SemanticVersion parse​(String input,
                                            boolean allowMissingMinorAndPatch)
                                     throws SemanticVersion.InvalidVersionException
        Attempts to parse a string as a semantic version according to the Semver 2.0.0 specification, except that the minor and patch versions may optionally be omitted.
        Parameters:
        input - the input string
        allowMissingMinorAndPatch - true if the parser should tolerate the absence of a minor and/or patch version; if absent, they will be treated as zero
        Returns:
        a SemanticVersion instance
        Throws:
        SemanticVersion.InvalidVersionException - if the version could not be parsed
      • comparePrecedence

        public int comparePrecedence​(SemanticVersion other)
        Compares this object with another SemanticVersion according to Semver 2.0.0 precedence rules.
        Parameters:
        other - another SemanticVersion
        Returns:
        0 if equal, -1 if the current object has lower precedence, or 1 if the current object has higher precedence