Class SemVer

java.lang.Object
org.honton.chas.compose.maven.plugin.SemVer
All Implemented Interfaces:
Comparable<SemVer>

public class SemVer extends Object implements Comparable<SemVer>
A semantic version mostly following the rules at semver.org. The major.minor.patch numbering scheme is loosened. If minor or patch is not supplied, the minor and patch attributes will be -1.
  • Constructor Details

    • SemVer

      public SemVer()
  • Method Details

    • valueOf

      public static SemVer valueOf(String version)
      Create an instance from the string specification
      Parameters:
      version - The string
      Returns:
      A SemVer; or null, if version is null
      Throws:
      IllegalArgumentException - when version is not a semantic version
    • getMajor

      public int getMajor()
      The major version. i.e. X of X.Y.Z
    • getMinor

      public int getMinor()
      The minor version. i.e. Y of X.Y.Z
    • getPatch

      public int getPatch()
      The patch version. i.e. Z of X.Y.Z
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • compareTo

      public int compareTo(@NonNull @NonNull SemVer other)
      Specified by:
      compareTo in interface Comparable<SemVer>