Class PersistenceId
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic PersistenceIdConstructs aPersistenceIdfrom the givenentityTypeHintandentityIdby concatenating them with|separator.static PersistenceIdConstructs aPersistenceIdfrom the givenentityTypeHintandentityIdby concatenating them with theseparator.static StringDefault separator character used for concatenating atypeHintwithentityIdto construct unique persistenceId.entityId()booleanstatic StringExtract theentityIdfrom a persistence id String with the default separator|.static StringExtract theentityTypeHintfrom a persistence id String with the default separator|.inthashCode()id()static PersistenceIdConstructs aPersistenceIdfrom the givenentityTypeHintandentityIdby concatenating them with|separator.static PersistenceIdConstructs aPersistenceIdfrom the givenentityTypeHintandentityIdby concatenating them with theseparator.static PersistenceIdofUniqueId(String id) Constructs aPersistenceIdwithidas the full unique identifier.toString()unapply(PersistenceId persistenceId)
-
Constructor Details
-
PersistenceId
public PersistenceId()
-
-
Method Details
-
DefaultSeparator
Default separator character used for concatenating atypeHintwithentityIdto construct unique persistenceId. -
apply
Constructs aPersistenceIdfrom the givenentityTypeHintandentityIdby concatenating them with|separator.Cluster Sharding is often used together with
EventSourcedBehaviorfor the entities. ThePersistenceIdof theEventSourcedBehaviorcan typically be constructed with:PersistenceId(entityContext.entityTypeKey.name, entityContext.entityId)That format of the
PersistenceIdis not mandatory and only provided as a convenience of a "standardized" format.Another separator can be defined by using the
applythat takes aseparatorparameter.- Throws:
IllegalArgumentException- if theentityTypeHintorentityIdcontains|
-
apply
Constructs aPersistenceIdfrom the givenentityTypeHintandentityIdby concatenating them with theseparator.Cluster Sharding is often used together with
EventSourcedBehaviorfor the entities. ThePersistenceIdof theEventSourcedBehaviorcan typically be constructed with:PersistenceId(entityContext.entityTypeKey.name, entityContext.entityId)That format of the
PersistenceIdis not mandatory and only provided as a convenience of a "standardized" format.The default separator
|is used by theapplythat doesn't take aseparatorparameter.- Throws:
IllegalArgumentException- if theentityTypeHintorentityIdcontainsseparator
-
of
Constructs aPersistenceIdfrom the givenentityTypeHintandentityIdby concatenating them with|separator.Cluster Sharding is often used together with
EventSourcedBehaviorfor the entities. ThePersistenceIdof theEventSourcedBehaviorcan typically be constructed with:PersistenceId.of(entityContext.getEntityTypeKey().name(), entityContext.getEntityId())That format of the
PersistenceIdis not mandatory and only provided as a convenience of a "standardized" format.Another separator can be defined by using the
PersistenceId.ofthat takes aseparatorparameter.- Throws:
IllegalArgumentException- if theentityTypeHintorentityIdcontains|
-
of
Constructs aPersistenceIdfrom the givenentityTypeHintandentityIdby concatenating them with theseparator.Cluster Sharding is often used together with
EventSourcedBehaviorfor the entities. ThePersistenceIdof theEventSourcedBehaviorcan typically be constructed with:PersistenceId.of(entityContext.getEntityTypeKey().name(), entityContext.getEntityId())That format of the
PersistenceIdis not mandatory and only provided as a convenience of a "standardized" format.The default separator
|is used by theapplythat doesn't take aseparatorparameter.- Throws:
IllegalArgumentException- if theentityTypeHintorentityIdcontainsseparator
-
ofUniqueId
Constructs aPersistenceIdwithidas the full unique identifier. -
extractEntityType
Extract theentityTypeHintfrom a persistence id String with the default separator|. If the separator|is not found it return the empty String (""). -
extractEntityId
Extract theentityIdfrom a persistence id String with the default separator|. If the separator|is not found it return theid. -
unapply
-
id
-
entityTypeHint
-
entityId
-
toString
-
hashCode
public int hashCode() -
equals
-