public class DefaultMultiCategoryIdentifierGenerator extends java.lang.Object implements MultiCategoryIdentifierGenerator
register(String, ObjectIdentifierProducer)
) with category related
ID producers once and then will be used with that setup for ID generation.
Registering further ID producers at a later time might cause errors because the
underlying ID producer registry is not thread-safe.Constructor and Description |
---|
DefaultMultiCategoryIdentifierGenerator() |
Modifier and Type | Method and Description |
---|---|
protected java.util.Map<java.lang.String,ObjectIdentifierProducer> |
getGeneratorRegistry() |
protected ObjectIdentifierProducer |
getIdProducer(java.lang.String categoryName) |
protected Logger2 |
log() |
java.lang.String |
newIdentifier(java.lang.String category)
Returns a new identifier for the given category.
|
long |
nextIdentifier(java.lang.String category)
Returns a new identifier which is different to the last one
for the given category.
|
protected java.lang.String |
normalizeCategory(java.lang.String category) |
DefaultMultiCategoryIdentifierGenerator |
register(java.lang.String categoryName,
ObjectIdentifierProducer idProducer)
Registers the given identifier producer for the specified category.
|
public DefaultMultiCategoryIdentifierGenerator()
public java.lang.String newIdentifier(java.lang.String category)
MultiCategoryIdentifierGenerator
newIdentifier
in interface MultiCategoryIdentifierGenerator
category
- An arbitrary but unique name for the ID sequence (must not be null).public long nextIdentifier(java.lang.String category)
MultiCategoryIdentifierGenerator
nextIdentifier
in interface MultiCategoryIdentifierGenerator
category
- An arbitrary but unique name for the ID sequence (must not be null).public DefaultMultiCategoryIdentifierGenerator register(java.lang.String categoryName, ObjectIdentifierProducer idProducer)
categoryName
- The category to register the ID producer under (must not be null or blank).idProducer
- The ID producer to be registered (must not be null).protected ObjectIdentifierProducer getIdProducer(java.lang.String categoryName)
protected java.lang.String normalizeCategory(java.lang.String category)
protected Logger2 log()
protected java.util.Map<java.lang.String,ObjectIdentifierProducer> getGeneratorRegistry()