Class TransitionId
java.lang.Object
com.yworkflow.definition.model.value.TransitionId
- All Implemented Interfaces:
Comparable<TransitionId>
Represents a unique identifier for a transition within a workflow. TransitionId is an immutable
value object that serves as the primary key for transitions within workflow definitions and
instances.
TransitionId instances can optionally include a human-readable name in addition to the unique identifier. This is useful for display purposes and debugging.
- Since:
- 1.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final TransitionIdAn empty TransitionId instance with an empty value and no name. -
Method Summary
Modifier and TypeMethodDescriptionintCompares this TransitionId with another TransitionId for ordering.booleanCompares this TransitionId with the specified object for equality.getName()Returns the optional human-readable name of this transition.getValue()Returns the string value of this transition ID.inthashCode()Returns the hash code for this TransitionId.Creates a new TransitionId instance with the same value but a different name.static TransitionIdCreates a new TransitionId instance with the specified value, or returns null if the value is null.toString()Returns a string representation of this TransitionId.static TransitionIdtransitionId(String value) Creates a new TransitionId instance with the specified value and no name.static TransitionIdtransitionId(String value, String name) Creates a new TransitionId instance with the specified value and name.
-
Field Details
-
EMPTY
An empty TransitionId instance with an empty value and no name.
-
-
Method Details
-
getValue
Returns the string value of this transition ID.- Returns:
- the transition ID value
-
getName
Returns the optional human-readable name of this transition.- Returns:
- an Optional containing the name if present, empty otherwise
-
transitionId
Creates a new TransitionId instance with the specified value and no name.- Parameters:
value- the string value for the transition ID- Returns:
- a new TransitionId instance
- Throws:
IllegalArgumentException- if the value is invalid
-
transitionId
Creates a new TransitionId instance with the specified value and name.- Parameters:
value- the string value for the transition IDname- the human-readable name for the transition (can be null)- Returns:
- a new TransitionId instance
- Throws:
IllegalArgumentException- if the value is invalid
-
orNull
Creates a new TransitionId instance with the specified value, or returns null if the value is null. This is useful for handling nullable string values.- Parameters:
value- the string value for the transition ID (can be null)- Returns:
- a new TransitionId instance or null if value is null
-
name
Creates a new TransitionId instance with the same value but a different name.- Parameters:
name- the new name for the transition- Returns:
- a new TransitionId instance with the specified name
-
compareTo
Compares this TransitionId with another TransitionId for ordering. Comparison is based on the string value of the transition ID.- Specified by:
compareToin interfaceComparable<TransitionId>- Parameters:
o- the TransitionId to compare with- Returns:
- a negative integer, zero, or a positive integer as this TransitionId is less than, equal to, or greater than the specified TransitionId
-
equals
Compares this TransitionId with the specified object for equality. Two TransitionId instances are equal if they have the same value. -
hashCode
public int hashCode()Returns the hash code for this TransitionId. -
toString
Returns a string representation of this TransitionId.
-