Skip to content

//workflow/com.squareup.workflow1/WorkflowIdentifier

WorkflowIdentifier

[jvm] class WorkflowIdentifier

Represents a Workflow‘s “identity” and is used by the runtime to determine whether a workflow is the same as one that was rendered in a previous render pass, in which case its state should be re-used; or if it’s a new workflow and needs to be started.

A workflow’s identity consists primarily of its concrete type (i.e. the class that implements the Workflow interface). Two workflows of the same concrete type are considered identical. However, if a workflow class implements ImpostorWorkflow, the identifier will also include that workflow’s ImpostorWorkflow.realIdentifier.

Instances of this class are equatable and hashable.

Identifiers and snapshots

Since workflows can be serialized, workflows’ identifiers must also be serializable in order to match workflows back up with their snapshots when restoring. However, some WorkflowIdentifiers may represent workflows that cannot be snapshotted. When an identifier is not snapshottable, toByteStringOrNull will return null, and any identifiers that reference ImpostorWorkflows whose ImpostorWorkflow.realIdentifier is not snapshottable will also not be snapshottable. Such identifiers are created with unsnapshottableIdentifier, but should not be used to wrap arbitrary workflows since those workflows may expect to be snapshotted.

Parameters

jvm

type

The KClass of the Workflow this identifier identifies, or the KType of an unsnapshottableIdentifier.

proxiedIdentifier

An optional identifier from ImpostorWorkflow.realIdentifier that will be used to further narrow the scope of this identifier.

description

Implementation of ImpostorWorkflow.describeRealIdentifier.

Types

Name Summary
Companion [jvm]
Content
object Companion


Functions

Name Summary
equals [jvm]
Content
open operator override fun equals(other: Any?): Boolean


getRealIdentifierType [jvm]
Content
@TestOnly()

fun getRealIdentifierType(): KAnnotatedElement
More info
Returns either a KClass or KType representing the “real” type that this identifier identifies – i.e.


hashCode [jvm]
Content
open override fun hashCode(): Int


toByteStringOrNull [jvm]
Content
fun toByteStringOrNull(): ByteString?
More info
If this identifier is snapshottable, returns the serialized form of the identifier.


toString [jvm]
Content
open override fun toString(): String
More info
If this identifier identifies an ImpostorWorkflow, returns the result of that workflow’s ImpostorWorkflow.describeRealIdentifier method, otherwise returns a description of this identifier including the name of its workflow type and any ImpostorWorkflow.realIdentifiers.