Class ForkId

java.lang.Object
com.yworkflow.definition.model.value.ForkId
All Implemented Interfaces:
DestinationId, ModelId

public class ForkId extends Object implements DestinationId
Represents a unique identifier for a workflow fork. ForkId is an immutable value object that identifies a specific fork operation within a workflow definition.

ForkId implements the DestinationId interface, making it suitable for use as a destination in workflow transitions. It supports both a value (required) and an optional name for human-readable identification.

Forks are used to split a workflow into multiple parallel paths, allowing multiple activities to be executed simultaneously. Each fork must have a unique identifier within the workflow definition.

Since:
1.0
See Also:
  • Method Details

    • getValue

      public String getValue()
      Returns the string value of this fork ID.
      Specified by:
      getValue in interface DestinationId
      Specified by:
      getValue in interface ModelId
      Returns:
      the fork identifier string
    • getName

      public Optional<String> getName()
      Returns the optional human-readable name of this fork.
      Specified by:
      getName in interface DestinationId
      Returns:
      an Optional containing the name if present, empty otherwise
    • isForkId

      public boolean isForkId()
      Returns true since this is a ForkId.
      Specified by:
      isForkId in interface DestinationId
      Returns:
      always true
    • forkId

      public static ForkId forkId(String value)
      Creates a new ForkId with the specified value and no name.
      Parameters:
      value - the fork identifier string
      Returns:
      a new ForkId instance
      Throws:
      IllegalArgumentException - if the value is invalid
    • forkId

      public static ForkId forkId(String value, String name)
      Creates a new ForkId with the specified value and name.
      Parameters:
      value - the fork identifier string
      name - the optional human-readable name
      Returns:
      a new ForkId instance
      Throws:
      IllegalArgumentException - if the value is invalid
    • name

      public ForkId name(String name)
      Creates a new ForkId with the same value but a different name.
      Parameters:
      name - the new name for this fork ID
      Returns:
      a new ForkId instance with the specified name
    • equals

      public boolean equals(Object object)
      Compares this ForkId with another object for equality. Two ForkId instances are equal if they have the same string value.
      Overrides:
      equals in class Object
      Parameters:
      object - the object to compare with
      Returns:
      true if the objects are equal, false otherwise
    • hashCode

      public int hashCode()
      Returns the hash code for this ForkId based on its string value.
      Overrides:
      hashCode in class Object
      Returns:
      the hash code for this ForkId
    • toString

      public String toString()
      Returns a string representation of this ForkId.
      Overrides:
      toString in class Object
      Returns:
      a string representation including the ID