Interface SemanticVersion

All Superinterfaces:
Comparable<Version>, Version

public interface SemanticVersion extends Version
Represents a Sematic Version.

Compared to a regular Version, this type of version receives better support for version comparisons in dependency notations, and is preferred.

See Also:
  • Field Details

  • Method Details

    • getVersionComponentCount

      int getVersionComponentCount()
      Returns the number of components in this version.

      For example, 1.3.x has 3 components.

      Returns:
      the number of components
    • getVersionComponent

      int getVersionComponent(int pos)
      Returns the version component at pos.

      May return COMPONENT_WILDCARD to indicate a wildcard component.

      If the pos exceeds the number of components, returns COMPONENT_WILDCARD if the version has wildcard; otherwise returns 0.

      Parameters:
      pos - the position to check
      Returns:
      the version component
    • getPrereleaseKey

      Optional<String> getPrereleaseKey()
      Returns the prerelease key in the version notation.

      The prerelease key is indicated by a - before a + in the version notation.

      Returns:
      the optional prerelease key
    • getBuildKey

      Optional<String> getBuildKey()
      Returns the build key in the version notation.

      The build key is indicated by a + in the version notation.

      Returns:
      the optional build key
    • hasWildcard

      boolean hasWildcard()
      Returns if a wildcard notation is present in this version.

      A wildcard notation is a x, X, or * in the version string, such as 2.5.*.

      Returns:
      whether this version has a wildcard notation
    • compareTo

      @Deprecated default int compareTo(SemanticVersion o)
      Deprecated.
      Use #compareTo(Version) instead
    • parse

      Parses a semantic version from a string notation.
      Parameters:
      s - the string notation of the version
      Returns:
      the parsed version
      Throws:
      VersionParsingException - if a problem arises during version parsing