|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.pfsw.db.util.DefaultMultiCategoryIdentifierGenerator
public class DefaultMultiCategoryIdentifierGenerator
A default implementation of an identifier generator for multiple categories.
The assumption is that an instance of this class gets generated and populated
(see 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 Summary | |
---|---|
DefaultMultiCategoryIdentifierGenerator()
|
Method Summary | |
---|---|
protected java.util.Map<java.lang.String,ObjectIdentifierProducer> |
getGeneratorRegistry()
|
protected ObjectIdentifierProducer |
getIdProducer(java.lang.String categoryName)
|
protected org.pfsw.logging.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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DefaultMultiCategoryIdentifierGenerator()
Method Detail |
---|
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 org.pfsw.logging.Logger2 log()
protected java.util.Map<java.lang.String,ObjectIdentifierProducer> getGeneratorRegistry()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |