public class ObjectTypeConverter extends Object implements Converter
Modifier and Type | Field and Description |
---|---|
protected Map |
attributeToFieldValues |
protected Object |
defaultAttributeValue |
protected Class |
fieldClassification |
protected String |
fieldClassificationName |
protected Map |
fieldToAttributeValues |
protected DatabaseMapping |
mapping |
Constructor and Description |
---|
ObjectTypeConverter()
PUBLIC:
Default constructor.
|
ObjectTypeConverter(DatabaseMapping mapping)
PUBLIC:
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addConversionValue(Object fieldValue,
Object attributeValue)
PUBLIC:
A type conversion value is a two-way mapping from the database to the object.
|
void |
addToAttributeOnlyConversionValue(Object fieldValue,
Object attributeValue)
PUBLIC:
An attribute only conversion value is a one-way mapping from the database to the object.
|
void |
convertClassNamesToClasses(ClassLoader classLoader)
INTERNAL:
Convert all the class-name-based settings in this converter to actual
class-based settings.
|
Object |
convertDataValueToObjectValue(Object fieldValue,
Session session)
INTERNAL:
Returns the corresponding attribute value for the specified field value.
|
Object |
convertObjectValueToDataValue(Object attributeValue,
Session session)
INTERNAL:
Convert to the data value.
|
Map |
getAttributeToFieldValues()
INTERNAL:
Get the attribute to field mapping.
|
Object |
getDefaultAttributeValue()
PUBLIC:
The default value can be used if the database can possibly store additional values then those that
have been mapped.
|
Class |
getFieldClassification()
INTERNAL:
Get the type of the field value to allow conversion from the database.
|
Class |
getFieldClassification(DatabaseField fieldToClassify)
INTERNAL:
Return the classifiction for the field contained in the mapping.
|
String |
getFieldClassificationName() |
Map |
getFieldToAttributeValues()
INTERNAL:
Get the field to attribute mapping.
|
protected DatabaseMapping |
getMapping()
INTERNAL:
Return the mapping.
|
void |
initialize(DatabaseMapping mapping,
Session session)
INTERNAL:
Set the mapping.
|
void |
initializeFieldClassification(Session session)
INTERNAL:
Set the field classification through searching the fields hashtable.
|
boolean |
isMutable()
INTERNAL:
If the converter converts the value to a non-atomic value, i.e.
|
boolean |
isObjectTypeMapping()
INTERNAL:
|
void |
mapBooleans()
PUBLIC:
This is a very specific protocol which maps fieldValues "T" and "F"
to true and false respectively.
|
void |
mapGenders()
PUBLIC:
This is a very specific protocol which maps fieldValues "F" and "M"
to "Female" and "Male" respectively.
|
void |
mapResponses()
PUBLIC:
This is a very specific protocol which maps fieldValues "Y" and "N"
to "Yes" and "No" respectively.
|
void |
setAttributeToFieldValues(Map attributeToFieldValues)
INTERNAL:
Set the attribute to field mapping.
|
void |
setDefaultAttributeValue(Object defaultAttributeValue)
PUBLIC:
The default value can be used if the database can possibly store additional values then those that
have been mapped.
|
void |
setFieldClassification(Class fieldClassification)
INTERNAL:
Set the type of the field value to allow conversion from the database.
|
void |
setFieldClassificationName(String fieldClassificationName) |
void |
setFieldToAttributeValueAssociations(Vector fieldToAttributeValueAssociations)
INTERNAL:
Set a collection of the field to attribute value associations.
|
void |
setFieldToAttributeValues(Map fieldToAttributeValues)
INTERNAL:
Set the field to attribute mapping.
|
protected void |
setMapping(DatabaseMapping mapping)
INTERNAL:
Set the mapping.
|
protected DatabaseMapping mapping
protected transient Map fieldToAttributeValues
protected Map attributeToFieldValues
protected transient Object defaultAttributeValue
protected transient Class fieldClassification
protected transient String fieldClassificationName
public ObjectTypeConverter()
public ObjectTypeConverter(DatabaseMapping mapping)
public void addConversionValue(Object fieldValue, Object attributeValue)
public void addToAttributeOnlyConversionValue(Object fieldValue, Object attributeValue)
public Map getAttributeToFieldValues()
public void convertClassNamesToClasses(ClassLoader classLoader)
classLoader
- public Object convertDataValueToObjectValue(Object fieldValue, Session session)
convertDataValueToObjectValue
in interface Converter
public Object getDefaultAttributeValue()
protected DatabaseMapping getMapping()
protected void setMapping(DatabaseMapping mapping)
public Class getFieldClassification()
public String getFieldClassificationName()
public Class getFieldClassification(DatabaseField fieldToClassify)
public Map getFieldToAttributeValues()
public Object convertObjectValueToDataValue(Object attributeValue, Session session)
convertObjectValueToDataValue
in interface Converter
public boolean isObjectTypeMapping()
public void mapBooleans()
public void mapGenders()
public void mapResponses()
public void initializeFieldClassification(Session session) throws DescriptorException
DescriptorException
public void initialize(DatabaseMapping mapping, Session session)
initialize
in interface Converter
public void setAttributeToFieldValues(Map attributeToFieldValues)
public void setDefaultAttributeValue(Object defaultAttributeValue)
public void setFieldClassification(Class fieldClassification)
public void setFieldClassificationName(String fieldClassificationName)
public void setFieldToAttributeValueAssociations(Vector fieldToAttributeValueAssociations)
public void setFieldToAttributeValues(Map fieldToAttributeValues)
Copyright © 2024. All rights reserved.