Class Version

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

    public class Version
    extends java.lang.Object
    implements java.lang.Comparable<Version>
    Value object to represent a Version consisting of major, minor and bugfix part.
    • Constructor Detail

      • Version

        public Version​(int... parts)
        Creates a new Version from the given integer values. At least one value has to be given but a maximum of 4.
        Parameters:
        parts - must not be null or empty.
    • Method Detail

      • parse

        public static Version parse​(java.lang.String version)
        Parses the given string representation of a version into a Version object.
        Parameters:
        version - must not be null or empty.
        Returns:
        returns version
      • isGreaterThan

        public boolean isGreaterThan​(Version version)
        Returns whether the current Version is greater (newer) than the given one.
        Parameters:
        version - - candidate version
        Returns:
        true or false based on version comparison
      • isGreaterThanOrEqualTo

        public boolean isGreaterThanOrEqualTo​(Version version)
        Returns whether the current Version is greater (newer) or the same as the given one.
        Parameters:
        version - - candidate version
        Returns:
        true or false based on version comparison
      • is

        public boolean is​(Version version)
        Returns whether the current Version is the same as the given one.
        Parameters:
        version - - candidate version
        Returns:
        true or false based on version comparison
      • isLessThan

        public boolean isLessThan​(Version version)
        Returns whether the current Version is less (older) than the given one.
        Parameters:
        version - - candidate version
        Returns:
        true or false based on version comparison
      • isLessThanOrEqualTo

        public boolean isLessThanOrEqualTo​(Version version)
        Returns whether the current Version is less (older) or equal to the current one.
        Parameters:
        version - - candidate version
        Returns:
        true or false based on version comparison
      • compareTo

        public int compareTo​(Version that)
        Specified by:
        compareTo in interface java.lang.Comparable<Version>
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • hashCode

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

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