java.lang.Object
io.axoniq.framework.workflow.runtime.api.execution.context.Version
All Implemented Interfaces:
Comparable<Version>

public final class Version extends Object implements Comparable<Version>
Workflow version value type. Wraps a semver string (MAJOR.MINOR.PATCH with optional -prerelease suffix) together with its parsed semver-aware comparison. Use this in place of raw String whenever ordering or "is-greater-than" logic is needed; the wire format stays String via value().
Since:
5.4.0
Author:
Stefan Dragisic
  • Field Details

    • DEFAULT_VERSION

      public static final String DEFAULT_VERSION
      The default version assigned to workflow definitions that do not declare one explicitly.
      See Also:
  • Method Details

    • of

      public static Version of(String value)
      Parses value as a semver string and returns the corresponding .
      Throws:
      IllegalArgumentException - if value is not a valid semver string.
    • validate

      public static void validate(String value)
      Validates value is a parseable semver string. Throws otherwise.
    • tryOf

      public static Optional<Version> tryOf(String value)
      Parses value as a semver string or returns empty when unparseable. Useful for filtering collections of mixed-quality version strings (e.g. legacy event streams).
    • closestNotGreaterThan

      public static Optional<Version> closestNotGreaterThan(Collection<Version> candidates, Version target)
      Returns the highest version less than or equal to target among candidates, or empty when no candidate qualifies. This is the "closest-sibling" routing rule.
    • closestHigherThan

      public static Optional<Version> closestHigherThan(Collection<Version> candidates, Version target)
      Returns the lowest version strictly greater than target among candidates, or empty when no candidate qualifies. This is the "closest-higher-sibling" routing rule.
    • value

      public String value()
      The canonical String representation, suitable for wire-format boundaries.
    • isGreaterThan

      public boolean isGreaterThan(Version other)
      true when this version is strictly greater than other in semver order.
    • isGreaterThanOrEqualTo

      public boolean isGreaterThanOrEqualTo(Version other)
      true when this version is greater than or equal to other in semver order.
    • compareTo

      public int compareTo(Version other)
      Specified by:
      compareTo in interface Comparable<Version>
    • equals

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

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

      public String toString()
      Overrides:
      toString in class Object