|
db4o 6.1 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface ObjectMarshaller
interface for custom marshallers.
Custom marshallers can be used for tuning the performance to store
and read objects. Instead of letting db4o do all the marshalling
by detecting the fields on a class and by using reflection, a
custom ObjectMarshaller
allows the
application developer to write the logic how the fields of an
object are converted to a byte[] and back.
To implement a custom marshaller, write a class that
implements the methods of the ObjectMarshaller
interface and register it for your persistent class:
Db4o.configure().objectClass(YourClass.class).marshallWith(yourMarshaller);
Method Summary | |
---|---|
int |
marshalledFieldLength()
return the length the marshalled fields will occupy in the slot byte[]. |
void |
readFields(java.lang.Object obj,
byte[] slot,
int offset)
implement to read the values of fields from a byte[] and to set them on an object when the object gets instantiated |
void |
writeFields(java.lang.Object obj,
byte[] slot,
int offset)
implement to write the values of fields to a byte[] when an object gets stored. |
Method Detail |
---|
void writeFields(java.lang.Object obj, byte[] slot, int offset)
obj
- the object that is storedslot
- the byte[] where the fields are to be writtenoffset
- the offset position in the byte[] where the first
field value can be writtenvoid readFields(java.lang.Object obj, byte[] slot, int offset)
obj
- the object that is instantiatedslot
- the byte[] where the fields are to be read fromoffset
- the offset position in the byte[] where the first
field value is to be read fromint marshalledFieldLength()
|
db4o 6.1 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |