Class WorkflowInstanceId
java.lang.Object
com.yworkflow.instance.model.value.WorkflowInstanceId
- All Implemented Interfaces:
Comparable<WorkflowInstanceId>
Represents a unique identifier for a workflow instance. WorkflowInstanceId is an immutable value
object that serves as the primary key for workflow instances within the yWorkflow engine.
WorkflowInstanceId instances are created using the workflowInstanceId(String) factory
method, which validates the input string to ensure it meets the requirements for workflow
instance IDs.
The class provides utility methods for common operations such as conversion to Long values (useful for database primary keys) and comparison for ordering.
- Since:
- 1.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final WorkflowInstanceIdAn empty WorkflowInstanceId instance with an empty string value. -
Method Summary
Modifier and TypeMethodDescriptionasLong()Converts this WorkflowInstanceId to a Long value.intCompares this WorkflowInstanceId with another WorkflowInstanceId for ordering.booleanCompares this WorkflowInstanceId with the specified object for equality.getValue()Returns the string value of this workflow instance ID.inthashCode()Returns the hash code for this WorkflowInstanceId.toString()Returns a string representation of this WorkflowInstanceId.static WorkflowInstanceIdworkflowInstanceId(String value) Creates a new WorkflowInstanceId instance with the specified value.
-
Field Details
-
EMPTY
An empty WorkflowInstanceId instance with an empty string value.
-
-
Method Details
-
getValue
Returns the string value of this workflow instance ID.- Returns:
- the workflow instance ID value
-
workflowInstanceId
Creates a new WorkflowInstanceId instance with the specified value. The value is validated to ensure it meets the requirements for workflow instance IDs.- Parameters:
value- the string value for the workflow instance ID- Returns:
- a new WorkflowInstanceId instance
- Throws:
IllegalArgumentException- if the value is invalid
-
compareTo
Compares this WorkflowInstanceId with another WorkflowInstanceId for ordering. Comparison is based on the string value of the workflow instance ID.- Specified by:
compareToin interfaceComparable<WorkflowInstanceId>- Parameters:
o- the WorkflowInstanceId to compare with- Returns:
- a negative integer, zero, or a positive integer as this WorkflowInstanceId is less than, equal to, or greater than the specified WorkflowInstanceId
-
equals
Compares this WorkflowInstanceId with the specified object for equality. Two WorkflowInstanceId instances are equal if they have the same value. -
hashCode
public int hashCode()Returns the hash code for this WorkflowInstanceId. -
toString
Returns a string representation of this WorkflowInstanceId. -
asLong
Converts this WorkflowInstanceId to a Long value. This is useful for database operations where numeric primary keys are required.- Returns:
- the Long representation of this workflow instance ID
- Throws:
NumberFormatException- if the value cannot be parsed as a Long
-