Class ResultId
java.lang.Object
com.yworkflow.definition.model.value.ResultId
- All Implemented Interfaces:
ModelId,Comparable<ResultId>
Represents a unique identifier for a workflow result. ResultId is an immutable value object that
identifies a specific result within a workflow transition.
ResultId implements both ModelId and Comparable interfaces, making it suitable for use as an identifier in workflow models and for ordering in collections. It supports both a value (required) and an optional name for human-readable identification.
Results define what happens after a transition is executed, including the destination state, any functions to be executed, and additional metadata about the transition outcome. Each result must have a unique identifier within its context.
- Since:
- 1.0
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionintCompares this ResultId with another for ordering.booleanCompares this ResultId with another object for equality.getName()Returns the optional human-readable name of this result.getValue()Returns the string value of this result ID.inthashCode()Returns the hash code for this ResultId based on its string value.static ResultIdCreates a ResultId from the given value, returning null if the value is null.static ResultIdCreates a ResultId from the given value and name, returning null if the value is null.static ResultIdCreates a new ResultId with the specified value and no name.static ResultIdCreates a new ResultId with the specified value and name.toString()Returns a string representation of this ResultId.
-
Method Details
-
getValue
Returns the string value of this result ID. -
getName
Returns the optional human-readable name of this result.- Returns:
- an Optional containing the name if present, empty otherwise
-
resultId
Creates a new ResultId with the specified value and no name.- Parameters:
value- the result identifier string- Returns:
- a new ResultId instance
- Throws:
IllegalArgumentException- if the value is invalid
-
resultId
Creates a new ResultId with the specified value and name.- Parameters:
value- the result identifier stringname- the optional human-readable name- Returns:
- a new ResultId instance
- Throws:
IllegalArgumentException- if the value is invalid
-
orNull
Creates a ResultId from the given value, returning null if the value is null.- Parameters:
value- the result identifier string- Returns:
- a new ResultId instance or null if value is null
-
orNull
Creates a ResultId from the given value and name, returning null if the value is null.- Parameters:
value- the result identifier stringname- the optional human-readable name- Returns:
- a new ResultId instance or null if value is null
-
compareTo
Compares this ResultId with another for ordering. Comparison is based on the string value.- Specified by:
compareToin interfaceComparable<ResultId>- Parameters:
o- the ResultId to compare with- Returns:
- a negative integer, zero, or a positive integer as this ResultId is less than, equal to, or greater than the specified ResultId
-
equals
Compares this ResultId with another object for equality. Two ResultId instances are equal if they have the same string value. -
hashCode
public int hashCode()Returns the hash code for this ResultId based on its string value. -
toString
Returns a string representation of this ResultId.
-