public class ConstantTransformer extends FieldTransformerAdapter
Purpose: Allows a field to always be mapped to a constant value. This allows default values to be provided for un-mapped fields.
org.eclipse.persistence.mappings.FieldTransformer
,
Serialized FormModifier and Type | Field and Description |
---|---|
protected java.lang.Object |
value |
Constructor and Description |
---|
ConstantTransformer() |
ConstantTransformer(java.lang.Object value)
PUBLIC:
Return a constant transformer for the constant value.
|
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
buildFieldValue(java.lang.Object object,
java.lang.String fieldName,
Session session)
INTERNAL:
Always return the constant value.
|
java.lang.Object |
getValue()
PUBLIC:
Return the value of the constant.
|
void |
setValue(java.lang.Object value)
PUBLIC:
Set the value of the constant.
|
initialize
public ConstantTransformer()
public ConstantTransformer(java.lang.Object value)
public java.lang.Object getValue()
public void setValue(java.lang.Object value)
public java.lang.Object buildFieldValue(java.lang.Object object, java.lang.String fieldName, Session session)
buildFieldValue
in interface FieldTransformer
buildFieldValue
in class FieldTransformerAdapter
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