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.
FieldTransformer
,
Serialized FormModifier and Type | Field and Description |
---|---|
protected Object |
value |
BUILD_FIELD_VALUE_METHOD
Constructor and Description |
---|
ConstantTransformer() |
ConstantTransformer(Object value)
PUBLIC:
Return a constant transformer for the constant value.
|
Modifier and Type | Method and Description |
---|---|
Object |
buildFieldValue(Object object,
String fieldName,
Session session)
INTERNAL:
Always return the constant value.
|
Object |
getValue()
PUBLIC:
Return the value of the constant.
|
void |
setValue(Object value)
PUBLIC:
Set the value of the constant.
|
initialize
protected Object value
public ConstantTransformer()
public ConstantTransformer(Object value)
public Object getValue()
public void setValue(Object value)
public Object buildFieldValue(Object object, String fieldName, Session session)
buildFieldValue
in interface CoreFieldTransformer<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 sessionCopyright © 2017–2020 Eclipse.org - EclipseLink Project. All rights reserved.