Interface ValueGenerationManager
-
- All Known Implementing Classes:
ValueGenerationManagerImpl
public interface ValueGenerationManagerManager for the creation of ValueGenerators. ValueGenerators are of two primary types.- unique : apply to any datastore, and generate unique values. For example, UUID, which generates the values in Java space.
- datastore : apply to a particular datastore, and member. For example, an RDBMS SEQUENCE.
Member Key
The member "key" is either the fully-qualified member name (e.g "mydomain.MyClass.myField") that is having its values generated, or is for a (surrogate) datastore id member (e.g "mydomain.MyClass (datastore-id)"). All unique generators can also be looked up by the strategy name (since there is one instance of that generator per strategy.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidclear()Method to clear out the generators managed by this manager.ValueGeneratorcreateAndRegisterValueGenerator(String memberKey, String strategyName, Properties props)Method to create and register a generator of the specified strategy, for the specified memberKey.ValueGeneratorcreateValueGenerator(String strategyName, String seqName, Properties props, ValueGenerationConnectionProvider connectionProvider)Method to create a ValueGenerator when the generator is datastore based.StringgetMemberKey(AbstractClassMetaData cmd)Simple way of generating a member "key" for use in lookups for datastore-identity.StringgetMemberKey(AbstractMemberMetaData mmd)Simple way of generating a member "key" for use in lookups.ClassgetTypeForValueGeneratorForMember(String strategyName, String memberKey)Accessor for the type of value that is generated by the ValueGenerator for the specified strategy, for the member "key".ValueGeneratorgetUniqueValueGeneratorByName(String name)Accessor for the "unique" ValueGenerator for the specified name (if any).ValueGeneratorgetValueGeneratorForMemberKey(String memberKey)Method to access the currently defined ValueGenerator for the specified member "key" (if any).voidregisterValueGeneratorForMemberKey(String memberKey, ValueGenerator generator)Method to store a ValueGenerator for the specified member "key".booleansupportsStrategy(String strategy)Convenience accessor for whether the specified strategy is supported for this datastore.
-
-
-
Method Detail
-
clear
void clear()
Method to clear out the generators managed by this manager.
-
getValueGeneratorForMemberKey
ValueGenerator getValueGeneratorForMemberKey(String memberKey)
Method to access the currently defined ValueGenerator for the specified member "key" (if any).- Parameters:
memberKey- The member "key"- Returns:
- Its ValueGenerator
-
registerValueGeneratorForMemberKey
void registerValueGeneratorForMemberKey(String memberKey, ValueGenerator generator)
Method to store a ValueGenerator for the specified member "key".- Parameters:
memberKey- The member "key"generator- The ValueGenerator to use for that member key
-
getUniqueValueGeneratorByName
ValueGenerator getUniqueValueGeneratorByName(String name)
Accessor for the "unique" ValueGenerator for the specified name (if any).- Parameters:
name- The (strategy) name.- Returns:
- The ValueGenerator for that name
-
getMemberKey
String getMemberKey(AbstractClassMetaData cmd)
Simple way of generating a member "key" for use in lookups for datastore-identity.- Parameters:
cmd- Metadata for the class using datastore-identity- Returns:
- The member "key" to use
-
getMemberKey
String getMemberKey(AbstractMemberMetaData mmd)
Simple way of generating a member "key" for use in lookups.- Parameters:
mmd- Metadata for the member- Returns:
- The member "key" to use
-
createAndRegisterValueGenerator
ValueGenerator createAndRegisterValueGenerator(String memberKey, String strategyName, Properties props)
Method to create and register a generator of the specified strategy, for the specified memberKey.- Parameters:
memberKey- The member keystrategyName- Strategy for the generatorprops- The properties to use- Returns:
- The ValueGenerator
-
getTypeForValueGeneratorForMember
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".- Parameters:
strategyName- The value generation strategymemberKey- The member "key"- Returns:
- The type of value generated
-
supportsStrategy
boolean supportsStrategy(String strategy)
Convenience accessor for whether the specified strategy is supported for this datastore.- Parameters:
strategy- The strategy name- Returns:
- Whether it is supported
-
createValueGenerator
ValueGenerator createValueGenerator(String strategyName, String seqName, Properties props, ValueGenerationConnectionProvider connectionProvider)
Method to create a ValueGenerator when the generator is datastore based. This is used solely by the NucleusSequence API to create a generator, but not to register it here for further use.- Parameters:
strategyName- Strategy nameseqName- Symbolic name of the generatorprops- Properties to control the generatorconnectionProvider- Provider for connections- Returns:
- The ValueGenerator
-
-