Class PersistenceId$


  • public class PersistenceId$
    extends java.lang.Object
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static PersistenceId$ MODULE$
      Static reference to the singleton instance of this Scala object.
    • Constructor Summary

      Constructors 
      Constructor Description
      PersistenceId$()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      PersistenceId apply​(java.lang.String entityTypeHint, java.lang.String entityId)
      Constructs a PersistenceId from the given entityTypeHint and entityId by concatenating them with | separator.
      PersistenceId apply​(java.lang.String entityTypeHint, java.lang.String entityId, java.lang.String separator)
      Constructs a PersistenceId from the given entityTypeHint and entityId by concatenating them with the separator.
      java.lang.String concat​(java.lang.String entityTypeHint, java.lang.String entityId)
      Constructs a persistence id String from the given entityTypeHint and entityId by concatenating them with | separator.
      java.lang.String concat​(java.lang.String entityTypeHint, java.lang.String entityId, java.lang.String separator)
      Constructs a persistence id String from the given entityTypeHint and entityId by concatenating them with the separator.
      java.lang.String DefaultSeparator()
      Default separator character used for concatenating a typeHint with entityId to construct unique persistenceId.
      java.lang.String extractEntityId​(java.lang.String id)
      Extract the entityId from a persistence id String with the default separator |.
      java.lang.String extractEntityType​(java.lang.String id)
      Extract the entityTypeHint from a persistence id String with the default separator |.
      PersistenceId of​(java.lang.String entityTypeHint, java.lang.String entityId)
      Constructs a PersistenceId from the given entityTypeHint and entityId by concatenating them with | separator.
      PersistenceId of​(java.lang.String entityTypeHint, java.lang.String entityId, java.lang.String separator)
      Constructs a PersistenceId from the given entityTypeHint and entityId by concatenating them with the separator.
      PersistenceId ofUniqueId​(java.lang.String id)
      Constructs a PersistenceId with id as the full unique identifier.
      scala.Option<scala.Tuple2<java.lang.String,​java.lang.String>> unapply​(PersistenceId persistenceId)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • MODULE$

        public static final PersistenceId$ MODULE$
        Static reference to the singleton instance of this Scala object.
    • Constructor Detail

      • PersistenceId$

        public PersistenceId$()
    • Method Detail

      • DefaultSeparator

        public java.lang.String DefaultSeparator()
        Default separator character used for concatenating a typeHint with entityId to construct unique persistenceId. This must be same as in Lagom's scaladsl.PersistentEntity, for compatibility. No separator is used in Lagom's javadsl.PersistentEntity so for compatibility with that the "" separator must be used instead.
      • apply

        public PersistenceId apply​(java.lang.String entityTypeHint,
                                   java.lang.String entityId)
        Constructs a PersistenceId from the given entityTypeHint and entityId by concatenating them with | separator.

        Cluster Sharding is often used together with EventSourcedBehavior for the entities. The PersistenceId of the EventSourcedBehavior can typically be constructed with:

        
         PersistenceId(entityContext.entityTypeKey.name, entityContext.entityId)
         

        That format of the PersistenceId is not mandatory and only provided as a convenience of a "standardized" format.

        Another separator can be defined by using the apply that takes a separator parameter.

        The | separator is also used in Lagom's scaladsl.PersistentEntity but no separator is used in Lagom's javadsl.PersistentEntity. For compatibility with Lagom's javadsl.PersistentEntity you should use "" as the separator.

        Throws:
        java.lang.IllegalArgumentException - if the entityTypeHint or entityId contains |
      • apply

        public PersistenceId apply​(java.lang.String entityTypeHint,
                                   java.lang.String entityId,
                                   java.lang.String separator)
        Constructs a PersistenceId from the given entityTypeHint and entityId by concatenating them with the separator.

        Cluster Sharding is often used together with EventSourcedBehavior for the entities. The PersistenceId of the EventSourcedBehavior can typically be constructed with:

        
         PersistenceId(entityContext.entityTypeKey.name, entityContext.entityId)
         

        That format of the PersistenceId is not mandatory and only provided as a convenience of a "standardized" format.

        The default separator | is used by the apply that doesn't take a separator parameter.

        The | separator is also used in Lagom's scaladsl.PersistentEntity but no separator is used in Lagom's javadsl.PersistentEntity. For compatibility with Lagom's javadsl.PersistentEntity you should use "" as the separator.

        Throws:
        java.lang.IllegalArgumentException - if the entityTypeHint or entityId contains separator
      • of

        public PersistenceId of​(java.lang.String entityTypeHint,
                                java.lang.String entityId)
        Constructs a PersistenceId from the given entityTypeHint and entityId by concatenating them with | separator.

        Cluster Sharding is often used together with EventSourcedBehavior for the entities. The PersistenceId of the EventSourcedBehavior can typically be constructed with:

        
         PersistenceId.of(entityContext.getEntityTypeKey().name(), entityContext.getEntityId())
         

        That format of the PersistenceId is not mandatory and only provided as a convenience of a "standardized" format.

        Another separator can be defined by using the PersistenceId.of that takes a separator parameter.

        The | separator is also used in Lagom's scaladsl.PersistentEntity but no separator is used in Lagom's javadsl.PersistentEntity. For compatibility with Lagom's javadsl.PersistentEntity you should use "" as the separator.

        Throws:
        java.lang.IllegalArgumentException - if the entityTypeHint or entityId contains |
      • of

        public PersistenceId of​(java.lang.String entityTypeHint,
                                java.lang.String entityId,
                                java.lang.String separator)
        Constructs a PersistenceId from the given entityTypeHint and entityId by concatenating them with the separator.

        Cluster Sharding is often used together with EventSourcedBehavior for the entities. The PersistenceId of the EventSourcedBehavior can typically be constructed with:

        
         PersistenceId.of(entityContext.getEntityTypeKey().name(), entityContext.getEntityId())
         

        That format of the PersistenceId is not mandatory and only provided as a convenience of a "standardized" format.

        The default separator | is used by the apply that doesn't take a separator parameter.

        The | separator is also used in Lagom's scaladsl.PersistentEntity but no separator is used in Lagom's javadsl.PersistentEntity. For compatibility with Lagom's javadsl.PersistentEntity you should use "" as the separator.

        Throws:
        java.lang.IllegalArgumentException - if the entityTypeHint or entityId contains separator
      • concat

        public java.lang.String concat​(java.lang.String entityTypeHint,
                                       java.lang.String entityId)
        Constructs a persistence id String from the given entityTypeHint and entityId by concatenating them with | separator.

        Throws:
        java.lang.IllegalArgumentException - if the entityTypeHint or entityId contains |
      • concat

        public java.lang.String concat​(java.lang.String entityTypeHint,
                                       java.lang.String entityId,
                                       java.lang.String separator)
        Constructs a persistence id String from the given entityTypeHint and entityId by concatenating them with the separator.

        Throws:
        java.lang.IllegalArgumentException - if the entityTypeHint or entityId contains separator
      • ofUniqueId

        public PersistenceId ofUniqueId​(java.lang.String id)
        Constructs a PersistenceId with id as the full unique identifier.
      • extractEntityType

        public java.lang.String extractEntityType​(java.lang.String id)
        Extract the entityTypeHint from a persistence id String with the default separator |. If the separator | is not found it return the empty String ("").
      • extractEntityId

        public java.lang.String extractEntityId​(java.lang.String id)
        Extract the entityId from a persistence id String with the default separator |. If the separator | is not found it return the id.
      • unapply

        public scala.Option<scala.Tuple2<java.lang.String,​java.lang.String>> unapply​(PersistenceId persistenceId)