Class Version
java.lang.Object
io.axoniq.framework.workflow.runtime.api.execution.context.Version
- All Implemented Interfaces:
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 Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe default version assigned to workflow definitions that do not declare one explicitly. -
Method Summary
Modifier and TypeMethodDescriptionclosestHigherThan(Collection<Version> candidates, Version target) Returns the lowest version strictly greater thantargetamongcandidates, or empty when no candidate qualifies.closestNotGreaterThan(Collection<Version> candidates, Version target) Returns the highest version less than or equal totargetamongcandidates, or empty when no candidate qualifies.intbooleaninthashCode()booleanisGreaterThan(Version other) truewhen this version is strictly greater thanotherin semver order.booleanisGreaterThanOrEqualTo(Version other) truewhen this version is greater than or equal tootherin semver order.static VersionParsesvalueas a semver string and returns the corresponding .toString()Parsesvalueas a semver string or returns empty when unparseable.static voidValidatesvalueis a parseable semver string.value()The canonicalStringrepresentation, suitable for wire-format boundaries.
-
Field Details
-
DEFAULT_VERSION
The default version assigned to workflow definitions that do not declare one explicitly.- See Also:
-
-
Method Details
-
of
Parsesvalueas a semver string and returns the corresponding .- Throws:
IllegalArgumentException- ifvalueis not a valid semver string.
-
validate
Validatesvalueis a parseable semver string. Throws otherwise. -
tryOf
Parsesvalueas 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 totargetamongcandidates, or empty when no candidate qualifies. This is the "closest-sibling" routing rule. -
closestHigherThan
Returns the lowest version strictly greater thantargetamongcandidates, or empty when no candidate qualifies. This is the "closest-higher-sibling" routing rule. -
value
The canonicalStringrepresentation, suitable for wire-format boundaries. -
isGreaterThan
truewhen this version is strictly greater thanotherin semver order. -
isGreaterThanOrEqualTo
truewhen this version is greater than or equal tootherin semver order. -
compareTo
- Specified by:
compareToin interfaceComparable<Version>
-
equals
-
hashCode
public int hashCode() -
toString
-