org.axonframework.domain
Class DefaultIdentifierFactory

java.lang.Object
  extended by org.axonframework.domain.IdentifierFactory
      extended by org.axonframework.domain.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 Summary
DefaultIdentifierFactory()
           
 
Method Summary
 String generateIdentifier()
          Generates a unique identifier for use by Entities (generally the Aggregate Root) and Events.
 
Methods inherited from class org.axonframework.domain.IdentifierFactory
getInstance
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultIdentifierFactory

public DefaultIdentifierFactory()
Method Detail

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


Copyright © 2010-2016. All Rights Reserved.