|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sleepycat.je.sync.RecordMapping
public class RecordMapping
Defines record conversion based on the fields/properties of a Java object, and uses a JE binding to convert between local raw records and Java objects.
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 Summary | |
---|---|
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,
Map<String,String> fieldMapping,
boolean partialMapping,
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,
Map<String,String> fieldMapping,
boolean partialMapping,
Class newRecordClass)
Creates a record mapping using separate key and value bindings, with an optional fieldMapping, fieldConverter, and newRecordClass. |
Method Summary | |
---|---|
void |
convertExternalToLocal(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,
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. |
String[] |
getExternalFieldNames()
Returns an array of the names of fields in the external RDBMS. |
Class[] |
getExternalFieldTypes()
Returns an array of the types of fields in the external RDBMS. |
Map<String,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. |
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(Class[] externalFieldTypes,
String[] externalFieldNames)
Called internally to initialize the converter. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public RecordMapping(EntityBinding entityBinding, boolean beanProperties)
public RecordMapping(EntityBinding entityBinding, boolean beanProperties, Map<String,String> fieldMapping, boolean partialMapping, Class newRecordClass)
public RecordMapping(EntryBinding keyBinding, EntryBinding valueBinding, boolean beanProperties)
public RecordMapping(EntryBinding keyBinding, EntryBinding valueBinding, boolean beanProperties, Map<String,String> fieldMapping, boolean partialMapping, Class newRecordClass)
Method Detail |
---|
public EntityBinding getEntityBinding()
public EntryBinding getKeyBinding()
public EntryBinding getValueBinding()
public boolean getBeanProperties()
public Map<String,String> getFieldMapping()
public boolean getPartialMapping()
public 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(Class[] externalFieldTypes, String[] externalFieldNames)
initializeConverter
in interface RecordConverter
public void convertLocalToExternal(DatabaseEntry localKey, DatabaseEntry localData, 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(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 Class[] getExternalFieldTypes()
RecordConverter
getExternalFieldTypes
in interface RecordConverter
RecordConverter.getExternalFieldTypes()
public String[] getExternalFieldNames()
RecordConverter
getExternalFieldNames
in interface RecordConverter
RecordConverter.getExternalFieldNames()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |