public class RecordMapping extends java.lang.Object implements RecordConverter
The set of field/properties in a Java object that are converted are those that are considered to be persistent. When bean properties are not used, the definition of persistent fields is the same as used in the DPL (TODO: add doc reference). When bean properties are used, all Java bean properties are considered to be persistent. The set of persistent fields/properties can be customized using the fieldMapping.
Constructor and Description |
---|
RecordMapping(EntityBinding entityBinding,
boolean beanProperties)
Creates a complete record mapping using an entity binding, with a null
fieldMapping, fieldConverter, and newRecordClass.
|
RecordMapping(EntityBinding entityBinding,
boolean beanProperties,
java.util.Map<java.lang.String,java.lang.String> fieldMapping,
boolean partialMapping,
java.lang.Class newRecordClass)
Creates a record mapping using an entity binding, with an optional
fieldMapping, fieldConverter, and newRecordClass.
|
RecordMapping(EntryBinding keyBinding,
EntryBinding valueBinding,
boolean beanProperties)
Creates a complete record mapping using separate key and value bindings,
with a null fieldMapping, fieldConverter, and newRecordClass.
|
RecordMapping(EntryBinding keyBinding,
EntryBinding valueBinding,
boolean beanProperties,
java.util.Map<java.lang.String,java.lang.String> fieldMapping,
boolean partialMapping,
java.lang.Class newRecordClass)
Creates a record mapping using separate key and value bindings, with an
optional fieldMapping, fieldConverter, and newRecordClass.
|
Modifier and Type | Method and Description |
---|---|
void |
convertExternalToLocal(java.lang.Object[] externalFieldValues,
DatabaseEntry localKey,
DatabaseEntry localData)
Called internally to convert an array of external record values to a
local raw data record.
|
void |
convertLocalToExternal(DatabaseEntry localKey,
DatabaseEntry localData,
java.lang.Object[] externalFieldValues)
Called internally to convert the local raw data record to an array of
external record values.
|
boolean |
getBeanProperties()
Returns true if local bean property names are used or false if local
field names are used.
|
EntityBinding |
getEntityBinding()
Returns the entity binding, or null if key and value bindings are used.
|
java.lang.String[] |
getExternalFieldNames()
Returns an array of the names of fields in the external RDBMS.
|
java.lang.Class[] |
getExternalFieldTypes()
Returns an array of the types of fields in the external RDBMS.
|
java.util.Map<java.lang.String,java.lang.String> |
getFieldMapping()
Returns a Map from local field/property name to external field/column
name, or null if no custom mapping is used.
|
EntryBinding |
getKeyBinding()
Returns the key binding, or null if an entity binding is used.
|
java.lang.Class |
getNewRecordClass()
Returns the class used to bind a newly inserted record in a JE Database.
|
boolean |
getPartialMapping()
Returns true if the field map is a partial mapping and other field names
that match should be transferred, or false if it is a complete mapping
and omitted names should not be transferred.
|
EntryBinding |
getValueBinding()
Returns the value binding, or null if an entity binding is used.
|
void |
initializeConverter(java.lang.Class[] externalFieldTypes,
java.lang.String[] externalFieldNames)
Called internally to initialize the converter.
|
public RecordMapping(EntityBinding entityBinding, boolean beanProperties)
public RecordMapping(EntityBinding entityBinding, boolean beanProperties, java.util.Map<java.lang.String,java.lang.String> fieldMapping, boolean partialMapping, java.lang.Class newRecordClass)
public RecordMapping(EntryBinding keyBinding, EntryBinding valueBinding, boolean beanProperties)
public RecordMapping(EntryBinding keyBinding, EntryBinding valueBinding, boolean beanProperties, java.util.Map<java.lang.String,java.lang.String> fieldMapping, boolean partialMapping, java.lang.Class newRecordClass)
public EntityBinding getEntityBinding()
public EntryBinding getKeyBinding()
public EntryBinding getValueBinding()
public boolean getBeanProperties()
public java.util.Map<java.lang.String,java.lang.String> getFieldMapping()
public boolean getPartialMapping()
public java.lang.Class getNewRecordClass()
When performing an import and no JE record currently exists, the Class.forName method is called to create a Java object for binding.
The newRecordClass may be null when import operations are not used for this data set.
public void initializeConverter(java.lang.Class[] externalFieldTypes, java.lang.String[] externalFieldNames)
initializeConverter
in interface RecordConverter
public void convertLocalToExternal(DatabaseEntry localKey, DatabaseEntry localData, java.lang.Object[] externalFieldValues)
Converts the local raw key/value to a Java object using the entity or key/value bindings, and returns the external field/column values obtained from the Java object using reflection.
convertLocalToExternal
in interface RecordConverter
public void convertExternalToLocal(java.lang.Object[] externalFieldValues, DatabaseEntry localKey, DatabaseEntry localData)
Converts the external field/column values to a Java object using reflection, and returns the local raw key/value obtained using the entity or key/value bindings.
convertExternalToLocal
in interface RecordConverter
public java.lang.Class[] getExternalFieldTypes()
RecordConverter
getExternalFieldTypes
in interface RecordConverter
RecordConverter.getExternalFieldTypes()
public java.lang.String[] getExternalFieldNames()
RecordConverter
getExternalFieldNames
in interface RecordConverter
RecordConverter.getExternalFieldNames()
Copyright (c) 2004-2012 Oracle. All rights reserved.