Class Version

java.lang.Object
com.pulumi.automation.Version
All Implemented Interfaces:
Comparable<Version>

public final class Version extends Object implements Comparable<Version>
Represents a semantic version (SemVer).
  • Method Details

    • of

      public static Version of(long major, long minor)
      Obtains a Version instance of the specified major, minor and patch versions.
      Parameters:
      major - a major version number, non-negative
      minor - a minor version number, non-negative
      Returns:
      the version
    • of

      public static Version of(long major, long minor, long patch)
      Obtains a Version instance of the specified major, minor and patch versions.
      Parameters:
      major - a major version number, non-negative
      minor - a minor version number, non-negative
      patch - a patch version number, non-negative
      Returns:
      the version
    • parse

      public static Version parse(String version)
      Parses a Version from the specified SemVer string.
      Parameters:
      version - the SemVer string to parse
      Returns:
      the version
    • tryParse

      public static Optional<Version> tryParse(String version)
      Parses a Version from the specified SemVer string.
      Parameters:
      version - the SemVer string to parse
      Returns:
      the version if it can be parsed; empty otherwise
    • majorVersion

      public long majorVersion()
      Returns the major version.
      Returns:
      the major version number
    • minorVersion

      public long minorVersion()
      Returns the minor version.
      Returns:
      the minor version number
    • patchVersion

      public long patchVersion()
      Returns the patch version.
      Returns:
      the patch version number
    • isHigherThan

      public boolean isHigherThan(Version other)
      Determines if this Version has a higher precedence compared with the specified Version.
      Parameters:
      other - the Version to compare with, non-null
      Returns:
      true, if this Version is higher than the other Version; false otherwise
    • isHigherThanOrEquivalentTo

      public boolean isHigherThanOrEquivalentTo(Version other)
      Determines if this Version has a higher or equal precedence compared with the specified Version.
      Parameters:
      other - the Version to compare with, non-null
      Returns:
      true, if this Version is higher than or equivalent to the other Version; false otherwise
    • isLowerThan

      public boolean isLowerThan(Version other)
      Determines if this Version has a lower precedence compared with the specified Version.
      Parameters:
      other - the Version to compare with, non-null
      Returns:
      true, if this Version is lower than the other Version; false otherwise
    • isLowerThanOrEquivalentTo

      public boolean isLowerThanOrEquivalentTo(Version other)
      Determines if this Version has a lower or equal precedence compared with the specified Version.
      Parameters:
      other - the Version to compare with, non-null
      Returns:
      true, if this Version is lower than or equivalent to the other Version; false otherwise
    • isEquivalentTo

      public boolean isEquivalentTo(Version other)
      Determines if this Version has the same precedence as the specified Version.
      Parameters:
      other - the Version to compare with, non-null
      Returns:
      true, if this Version is equivalent to the other Version; false otherwise
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • compareTo

      public int compareTo(Version o)
      Specified by:
      compareTo in interface Comparable<Version>
    • toString

      public String toString()
      Overrides:
      toString in class Object