Class ConstantTransformer
java.lang.Object
org.eclipse.persistence.mappings.transformers.FieldTransformerAdapter
org.eclipse.persistence.mappings.transformers.ConstantTransformer
- All Implemented Interfaces:
Serializable,CoreFieldTransformer<Session>,FieldTransformer
Purpose: Allows a field to always be mapped to a constant value. This allows default values to be provided for un-mapped fields.
- See Also:
- Author:
- James Sutherland
-
Field Summary
FieldsFields inherited from interface org.eclipse.persistence.core.mappings.transformers.CoreFieldTransformer
BUILD_FIELD_VALUE_METHOD -
Constructor Summary
ConstructorsConstructorDescriptionConstantTransformer(Object value) PUBLIC: Return a constant transformer for the constant value. -
Method Summary
Methods inherited from class org.eclipse.persistence.mappings.transformers.FieldTransformerAdapter
initialize
-
Field Details
-
value
-
-
Constructor Details
-
ConstantTransformer
public ConstantTransformer() -
ConstantTransformer
PUBLIC: Return a constant transformer for the constant value.
-
-
Method Details
-
getValue
PUBLIC: Return the value of the constant. -
setValue
PUBLIC: Set the value of the constant. -
buildFieldValue
INTERNAL: Always return the constant value.- Specified by:
buildFieldValuein interfaceCoreFieldTransformer<Session>- Specified by:
buildFieldValuein interfaceFieldTransformer- Overrides:
buildFieldValuein classFieldTransformerAdapter- Parameters:
object- - an instance of the domain class which contains the attributefieldName- - the name of the field being transformed. Used if the user wants to use this transformer for multiple fields.session- - the current session- Returns:
- - The value to be written for the field associated with this transformer
-