public class ObjectTypeConverter extends Object implements Converter, org.eclipse.persistence.internal.descriptors.ClassNameConversionRequired
Modifier and Type | Field and Description |
---|---|
protected Map<String,String> |
addToAttributeOnlyConversionValueStrings |
protected Map |
attributeToFieldValues |
protected Map<String,String> |
conversionValueStrings |
protected String |
converterName |
protected Class |
dataType |
protected String |
dataTypeName |
protected Object |
defaultAttributeValue |
protected String |
defaultAttributeValueString |
protected Class |
fieldClassification |
protected String |
fieldClassificationName |
protected Map |
fieldToAttributeValues |
protected DatabaseMapping |
mapping |
protected Class |
objectType |
protected String |
objectTypeName |
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 |
addConversionValueStrings(String dataValue,
String objectValue)
INTERNAL:
Set from JPA processing where we deal with strings only to avoid
class loader conflicts.
|
void |
addToAttributeOnlyConversionValue(Object fieldValue,
Object attributeValue)
PUBLIC:
An attribute only conversion value is a one-way mapping from the database to the object.
|
void |
addToAttributeOnlyConversionValueStrings(String dataValue,
String objectValue)
INTERNAL:
Set from JPA processing where we deal with strings only to avoid
class loader conflicts.
|
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(org.eclipse.persistence.internal.helper.DatabaseField fieldToClassify)
INTERNAL:
Return the classifiction for the field contained in the mapping.
|
String |
getFieldClassificationName() |
Vector |
getFieldToAttributeValueAssociations()
INTERNAL:
Return a collection of the field to attribute value associations.
|
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 map.
|
boolean |
isMutable()
INTERNAL:
If the converter converts the value to a non-atomic value, i.e.
|
protected Class |
loadClass(String className,
ClassLoader classLoader)
Load the given class name with the given loader.
|
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 |
setConverterName(String converterName)
INTERNAL:
Set from JPA processing where we deal with strings only to avoid
class loader conflicts.
|
void |
setDataTypeName(String dataTypeName)
INTERNAL:
Set from JPA processing where we deal with strings only to avoid
class loader conflicts.
|
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 |
setDefaultAttributeValueString(String defaultAttributeValueString)
INTERNAL:
Set from JPA processing where we deal with strings only to avoid
class loader conflicts.
|
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.
|
void |
setObjectTypeName(String objectTypeName)
INTERNAL:
Set from JPA processing where we deal with strings only to avoid
class loader conflicts.
|
protected void |
throwInitObjectException(Exception exception,
Class type,
String value,
boolean isData)
INTERNAL:
|
protected String converterName
protected Class dataType
protected String dataTypeName
protected Class objectType
protected String objectTypeName
protected Map<String,String> addToAttributeOnlyConversionValueStrings
protected DatabaseMapping mapping
protected transient Map fieldToAttributeValues
protected Map attributeToFieldValues
protected transient Object defaultAttributeValue
protected String defaultAttributeValueString
protected transient Class fieldClassification
protected transient String fieldClassificationName
public ObjectTypeConverter()
public ObjectTypeConverter(DatabaseMapping mapping)
public void addConversionValue(Object fieldValue, Object attributeValue)
public void addConversionValueStrings(String dataValue, String objectValue)
public void addToAttributeOnlyConversionValue(Object fieldValue, Object attributeValue)
public void addToAttributeOnlyConversionValueStrings(String dataValue, String objectValue)
public Map getAttributeToFieldValues()
public void convertClassNamesToClasses(ClassLoader classLoader)
convertClassNamesToClasses
in interface org.eclipse.persistence.internal.descriptors.ClassNameConversionRequired
classLoader
- protected Class loadClass(String className, ClassLoader classLoader)
public Object convertDataValueToObjectValue(Object fieldValue, Session session)
convertDataValueToObjectValue
in interface CoreConverter<DatabaseMapping,Session>
convertDataValueToObjectValue
in interface Converter
public Object getDefaultAttributeValue()
protected DatabaseMapping getMapping()
protected void setMapping(DatabaseMapping mapping)
public void setObjectTypeName(String objectTypeName)
public Class getFieldClassification()
public String getFieldClassificationName()
public Class getFieldClassification(org.eclipse.persistence.internal.helper.DatabaseField fieldToClassify)
public Vector getFieldToAttributeValueAssociations()
public Map getFieldToAttributeValues()
public Object convertObjectValueToDataValue(Object attributeValue, Session session)
convertObjectValueToDataValue
in interface CoreConverter<DatabaseMapping,Session>
convertObjectValueToDataValue
in interface Converter
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 CoreConverter<DatabaseMapping,Session>
initialize
in interface Converter
public void setAttributeToFieldValues(Map attributeToFieldValues)
public void setConverterName(String converterName)
public void setDataTypeName(String dataTypeName)
public void setDefaultAttributeValue(Object defaultAttributeValue)
public void setDefaultAttributeValueString(String defaultAttributeValueString)
public void setFieldClassification(Class fieldClassification)
public void setFieldClassificationName(String fieldClassificationName)
public void setFieldToAttributeValueAssociations(Vector fieldToAttributeValueAssociations)
public void setFieldToAttributeValues(Map fieldToAttributeValues)
public boolean isMutable()
Copyright © 2007–2020 Eclipse.org - EclipseLink Project. All rights reserved.