Class MaxValueIncrementerFactory
java.lang.Object
org.kuali.rice.krad.data.platform.MaxValueIncrementerFactory
Factory for obtaining instances of
DataFieldMaxValueIncrementer for a given DataSource and
incrementer name.
These incrementers are used for getting generated incrementing values like that provided by a database-level sequence generator.
Note that not all database platforms support sequences natively, so incrementers can be returned that emulate
sequence-like behavior. The Spring Framework provides incrementer implementations for numerous different database
platforms. This classes uses DatabasePlatforms to determine the platform of the given DataSource.
Note that this class will cache internally any incrementers for a given DataSource + Incrementer Name
combination.
- Author:
- Kuali Rice Team (rice.collab@kuali.org)
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringPrefix for property names used to identify the classname for aDataFieldMaxValueIncrementerto use for a given platform. -
Method Summary
Modifier and TypeMethodDescriptionstatic org.springframework.jdbc.support.incrementer.DataFieldMaxValueIncrementergetIncrementer(DataSource dataSource, String incrementerName) Either constructs a new incrementer or retrieves a cached instance for the given DataSource and target incrementer name.
-
Field Details
-
PLATFORM_INCREMENTER_PREFIX
Prefix for property names used to identify the classname for aDataFieldMaxValueIncrementerto use for a given platform.To construct a full property name, concatenate this prefix with the platform name.
- See Also:
-
-
Method Details
-
getIncrementer
public static org.springframework.jdbc.support.incrementer.DataFieldMaxValueIncrementer getIncrementer(DataSource dataSource, String incrementerName) Either constructs a new incrementer or retrieves a cached instance for the given DataSource and target incrementer name.- Parameters:
dataSource- theDataSourcefor which to retrieve the incrementer.incrementerName- the case-insensitive name of the incrementer to use, this will generally be the name of the database object which is used to implement the incrementer.- Returns:
- an incrementer that can be used to generate the next incremented value for the given incrementer against
the specified
DataSource. - Throws:
IllegalArgumentException- if dataSource or incrementerName are null or blank.
-