Class ImmutableWorkflowCaller

java.lang.Object
com.yworkflow.common.caller.ImmutableWorkflowCaller
All Implemented Interfaces:
WorkflowCaller, Comparable<WorkflowCaller>

public class ImmutableWorkflowCaller extends Object implements WorkflowCaller
Immutable implementation of WorkflowCaller that stores a caller identity string. This class provides a thread-safe, immutable representation of a workflow caller that can be used for access control and audit purposes.

ImmutableWorkflowCaller instances are created with a caller identity string, which can be null for anonymous callers. The class implements proper comparison semantics and provides access to the caller value through the WorkflowCaller interface.

This implementation is used internally by the WorkflowCaller factory methods and provides the default behavior for caller identity management.

Since:
1.0
See Also:
  • Constructor Details

    • ImmutableWorkflowCaller

      public ImmutableWorkflowCaller(String caller)
      Creates a new ImmutableWorkflowCaller with the specified caller identity.
      Parameters:
      caller - the caller identity string (can be null for anonymous callers)
  • Method Details

    • value

      public Optional<String> value()
      Returns the optional caller identity string.
      Specified by:
      value in interface WorkflowCaller
      Returns:
      an Optional containing the caller identity if present, empty for anonymous callers
    • compareTo

      public int compareTo(WorkflowCaller o)
      Compares this WorkflowCaller with another WorkflowCaller for ordering. Comparison is based on the caller identity string, with null values being treated as empty strings.
      Specified by:
      compareTo in interface Comparable<WorkflowCaller>
      Parameters:
      o - the WorkflowCaller to compare with
      Returns:
      a negative integer, zero, or a positive integer as this WorkflowCaller is less than, equal to, or greater than the specified WorkflowCaller