Methods Summary |
---|
public java.lang.Object | convertDataValueToObjectValue(java.lang.Object fieldValue, oracle.toplink.essentials.sessions.Session session)INTERNAL:
The fieldValue will be a byte array. Create a ByteArrayInputStream
on the fieldValue. Create an ObjectInputStream on the ByteArrayInputStream
to read in the objects.
byte[] bytes;
try {
bytes = (byte[])((AbstractSession)session).getDatasourcePlatform().convertObject(fieldValue, ClassConstants.APBYTE);
} catch (ConversionException e) {
throw ConversionException.couldNotBeConverted(mapping, mapping.getDescriptor(), e);
}
if ((bytes == null) || (bytes.length == 0)) {
return null;
}
ByteArrayInputStream byteIn = new ByteArrayInputStream(bytes);
Object object = null;
try {
// BUG# 2813583
CustomObjectInputStream objectIn = new CustomObjectInputStream(byteIn, session);
object = objectIn.readObject();
} catch (Exception exception) {
throw DescriptorException.notDeserializable(getMapping(), exception);
}
return object;
|
public java.lang.Object | convertObjectValueToDataValue(java.lang.Object attributeValue, oracle.toplink.essentials.sessions.Session session)INTERNAL:
Convert the object to a byte array through serialize.
ByteArrayOutputStream byteOut = new ByteArrayOutputStream();
try {
ObjectOutputStream objectOut = new ObjectOutputStream(byteOut);
objectOut.writeObject(attributeValue);
objectOut.flush();
} catch (IOException exception) {
throw DescriptorException.notSerializable(getMapping(), exception);
}
return byteOut.toByteArray();
|
protected oracle.toplink.essentials.mappings.DatabaseMapping | getMapping()INTERNAL:
Return the mapping.
return mapping;
|
public void | initialize(oracle.toplink.essentials.mappings.DatabaseMapping mapping, oracle.toplink.essentials.sessions.Session session)INTERNAL:
Set the mapping.
this.mapping = mapping;
// CR#... Mapping must also have the field classification.
if (getMapping().isDirectToFieldMapping()) {
AbstractDirectMapping directMapping = (AbstractDirectMapping)getMapping();
// Allow user to specify field type to override computed value. (i.e. blob, nchar)
if (directMapping.getFieldClassification() == null) {
directMapping.setFieldClassification(ClassConstants.APBYTE);
}
}
|
public boolean | isMutable()INTERNAL:
If the converter converts the value to a non-atomic value, i.e.
a value that can have its' parts changed without being replaced,
then it must return false, serialization can be non-atomic.
return true;
|