Package com.yworkflow.common.caller
Record Class ImmutableWorkflowCallerContext
java.lang.Object
java.lang.Record
com.yworkflow.common.caller.ImmutableWorkflowCallerContext
- Record Components:
tenantId- the tenant ID for this contextcaller- the caller for this context
- All Implemented Interfaces:
WorkflowCallerContext
public record ImmutableWorkflowCallerContext(TenantId tenantId, WorkflowCaller caller)
extends Record
implements WorkflowCallerContext
Immutable implementation of WorkflowCallerContext using a record. This class provides a
thread-safe, immutable representation of a caller context that combines tenant information with
caller identity.
ImmutableWorkflowCallerContext is implemented as a record, which automatically provides implementations for equals(), hashCode(), and toString() methods based on the record components. This ensures proper value semantics for the context.
The class implements the fluent interface pattern, allowing for easy creation of new contexts with modified tenant or caller information while maintaining immutability.
- Since:
- 1.0
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionImmutableWorkflowCallerContext(TenantId tenantId, WorkflowCaller caller) Creates an instance of aImmutableWorkflowCallerContextrecord class. -
Method Summary
Modifier and TypeMethodDescriptionactAs(WorkflowCaller caller) Creates a new WorkflowCallerContext with the specified caller, keeping the same tenant ID.caller()Returns the value of thecallerrecord component.final booleanIndicates whether some other object is "equal to" this one.Creates a new WorkflowCallerContext with the specified tenant ID, keeping the same caller.final inthashCode()Returns a hash code value for this object.tenantId()Returns the value of thetenantIdrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
Method Details
-
from
Creates a new WorkflowCallerContext with the specified tenant ID, keeping the same caller.- Specified by:
fromin interfaceWorkflowCallerContext- Parameters:
tenantId- the new tenant ID- Returns:
- a new ImmutableWorkflowCallerContext with the specified tenant ID
-
actAs
Creates a new WorkflowCallerContext with the specified caller, keeping the same tenant ID.- Specified by:
actAsin interfaceWorkflowCallerContext- Parameters:
caller- the new caller- Returns:
- a new ImmutableWorkflowCallerContext with the specified caller
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
tenantId
Returns the value of thetenantIdrecord component.- Specified by:
tenantIdin interfaceWorkflowCallerContext- Returns:
- the value of the
tenantIdrecord component
-
caller
Returns the value of thecallerrecord component.- Specified by:
callerin interfaceWorkflowCallerContext- Returns:
- the value of the
callerrecord component
-