public class ValueGenerationManagerImpl extends Object implements ValueGenerationManager
Modifier and Type | Field and Description |
---|---|
protected Map<String,ValueGenerator> |
generatorsByMemberKey
Map of ValueGenerators, keyed by the member key ("{class}.{field}", or "{class} + (datastore-id)").
|
protected StoreManager |
storeMgr |
protected Map<String,ValueGenerator> |
uniqueGeneratorsByName
Map of "unique" ValueGenerators, keyed by their strategy name.
|
Constructor and Description |
---|
ValueGenerationManagerImpl(StoreManager storeMgr)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
clear()
Method to clear out the generators managed by this manager.
|
ValueGenerator |
createAndRegisterValueGenerator(String memberKey,
String strategyName,
Properties props)
Method to create and register a generator of the specified strategy, for the specified memberKey.
|
ValueGenerator |
createValueGenerator(String strategyName,
String seqName,
Properties props,
ValueGenerationConnectionProvider connectionProvider)
Method to create a ValueGenerator when the generator is datastore based.
|
String |
getMemberKey(AbstractClassMetaData cmd,
int fieldNumber)
Simple way of generating a member "key" for use in lookups.
|
Class |
getTypeForValueGeneratorForMember(String strategyName,
String memberKey)
Accessor for the type of value that is generated by the ValueGenerator for the specified strategy, for the member "key".
|
ValueGenerator |
getUniqueValueGeneratorByName(String name)
Accessor for the "unique" ValueGenerator for the specified name (if any).
|
ValueGenerator |
getValueGeneratorForMemberKey(String memberKey)
Method to access the currently defined ValueGenerator for the specified member "key" (if any).
|
void |
registerValueGeneratorForMemberKey(String memberKey,
ValueGenerator generator)
Method to store a ValueGenerator for the specified member "key".
|
boolean |
supportsStrategy(String strategy)
Convenience accessor for whether the specified strategy is supported for this datastore.
|
protected final StoreManager storeMgr
protected Map<String,ValueGenerator> generatorsByMemberKey
protected Map<String,ValueGenerator> uniqueGeneratorsByName
public ValueGenerationManagerImpl(StoreManager storeMgr)
storeMgr
- Store Managerpublic void clear()
ValueGenerationManager
clear
in interface ValueGenerationManager
public ValueGenerator getValueGeneratorForMemberKey(String memberKey)
ValueGenerationManager
getValueGeneratorForMemberKey
in interface ValueGenerationManager
memberKey
- The member "key"public void registerValueGeneratorForMemberKey(String memberKey, ValueGenerator generator)
ValueGenerationManager
registerValueGeneratorForMemberKey
in interface ValueGenerationManager
memberKey
- The member "key"generator
- The ValueGenerator to use for that member keypublic ValueGenerator getUniqueValueGeneratorByName(String name)
ValueGenerationManager
getUniqueValueGeneratorByName
in interface ValueGenerationManager
name
- The (strategy) name.public String getMemberKey(AbstractClassMetaData cmd, int fieldNumber)
ValueGenerationManager
getMemberKey
in interface ValueGenerationManager
cmd
- Metadata for the classfieldNumber
- The field number (absolute). -1 if datastore-id surrogate member.public Class getTypeForValueGeneratorForMember(String strategyName, String memberKey)
ValueGenerationManager
getTypeForValueGeneratorForMember
in interface ValueGenerationManager
strategyName
- The value generation strategymemberKey
- The member "key"public ValueGenerator createAndRegisterValueGenerator(String memberKey, String strategyName, Properties props)
ValueGenerationManager
createAndRegisterValueGenerator
in interface ValueGenerationManager
memberKey
- The member keystrategyName
- Strategy for the generatorprops
- The properties to usepublic boolean supportsStrategy(String strategy)
ValueGenerationManager
supportsStrategy
in interface ValueGenerationManager
strategy
- The strategy namepublic ValueGenerator createValueGenerator(String strategyName, String seqName, Properties props, ValueGenerationConnectionProvider connectionProvider)
ValueGenerationManager
createValueGenerator
in interface ValueGenerationManager
strategyName
- Strategy nameseqName
- Symbolic name of the generatorprops
- Properties to control the generatorconnectionProvider
- Provider for connectionsCopyright © 2019. All rights reserved.