Class DefaultIdentifierFactory

java.lang.Object
org.axonframework.common.IdentifierFactory
org.axonframework.common.DefaultIdentifierFactory

public class DefaultIdentifierFactory extends IdentifierFactory
Default IdentifierFactory implementation that uses generates random java.util.UUID based identifiers. Although the performance of this strategy is not the best out there, it has native supported on all JVMs.

This implementations selects a random identifier out of about 3 x 1038 possible values, making the chance to get a duplicate incredibly small.

Since:
1.2
Author:
Allard Buijze
  • Constructor Details

    • DefaultIdentifierFactory

      public DefaultIdentifierFactory()
  • Method Details

    • generateIdentifier

      public String generateIdentifier()
      Generates a unique identifier for use by Entities (generally the Aggregate Root) and Events. The implementation may choose whatever strategy it sees fit, as long as the chance of a duplicate identifier is acceptable to the application.

      This implementation creates identifiers based on pseudo-random UUIDs.

      Specified by:
      generateIdentifier in class IdentifierFactory
      Returns:
      a String representation of a unique identifier