Class SaltVersion

  • All Implemented Interfaces:
    java.lang.Comparable<SaltVersion>

    public class SaltVersion
    extends java.lang.Object
    implements java.lang.Comparable<SaltVersion>
    Represents a salt version
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private int bugfix  
      private int month  
      private java.util.Optional<java.lang.Integer> releaseCandidate  
      private static java.util.regex.Pattern SALT_VERSION_REGEX  
      private int year  
    • Constructor Summary

      Constructors 
      Constructor Description
      SaltVersion​(int year, int month, int bugfix)
      Creates a SaltVersion without release candidate tag
      SaltVersion​(int year, int month, int bugfix, int releaseCandidate)
      Creates a SaltVersion
      SaltVersion​(int year, int month, int bugfix, java.util.Optional<java.lang.Integer> releaseCandidate)
      Creates a SaltVersion
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int compareTo​(SaltVersion other)  
      int getBugfix()
      Getter for the bugfix of this SaltVersion
      int getMonth()
      Getter for the month of this SaltVersion
      java.util.Optional<java.lang.Integer> getReleaseCandidate()
      Getter for the release candidate of this SaltVersion
      int getYear()
      Getter for the year of this SaltVersion
      static java.util.Optional<SaltVersion> parse​(java.lang.String versionString)
      Parses a salt version string
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • SALT_VERSION_REGEX

        private static java.util.regex.Pattern SALT_VERSION_REGEX
      • year

        private final int year
      • month

        private final int month
      • bugfix

        private final int bugfix
      • releaseCandidate

        private final java.util.Optional<java.lang.Integer> releaseCandidate
    • Constructor Detail

      • SaltVersion

        public SaltVersion​(int year,
                           int month,
                           int bugfix,
                           java.util.Optional<java.lang.Integer> releaseCandidate)
        Creates a SaltVersion
        Parameters:
        year - Year of the release
        month - Month of the release
        bugfix - Bugfix number incremented withing a feature release
        releaseCandidate - Optional release candidate tag
      • SaltVersion

        public SaltVersion​(int year,
                           int month,
                           int bugfix,
                           int releaseCandidate)
        Creates a SaltVersion
        Parameters:
        year - Year of the release
        month - Month of the release
        bugfix - Bugfix number incremented withing a feature release
        releaseCandidate - release candidate tag
      • SaltVersion

        public SaltVersion​(int year,
                           int month,
                           int bugfix)
        Creates a SaltVersion without release candidate tag
        Parameters:
        year - Year of the release
        month - Month of the release
        bugfix - Bugfix number incremented withing a feature release
    • Method Detail

      • parse

        public static java.util.Optional<SaltVersion> parse​(java.lang.String versionString)
        Parses a salt version string
        Parameters:
        versionString - the salt version string
        Returns:
        SaltVersion if the versionString is valid or empty Optional if not.
      • getReleaseCandidate

        public java.util.Optional<java.lang.Integer> getReleaseCandidate()
        Getter for the release candidate of this SaltVersion
        Returns:
        the optional release candidate
      • getYear

        public int getYear()
        Getter for the year of this SaltVersion
        Returns:
        the year
      • getMonth

        public int getMonth()
        Getter for the month of this SaltVersion
        Returns:
        the month
      • getBugfix

        public int getBugfix()
        Getter for the bugfix of this SaltVersion
        Returns:
        the bugfix number
      • toString

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

        public int compareTo​(SaltVersion other)
        Specified by:
        compareTo in interface java.lang.Comparable<SaltVersion>