Package com.db4o.internal.marshall
Class MarshallingContext
- java.lang.Object
-
- com.db4o.internal.marshall.MarshallingContext
-
- All Implemented Interfaces:
AspectVersionContext,MarshallingInfo,Context,WriteBuffer,WriteContext
public class MarshallingContext extends java.lang.Object implements MarshallingInfo, WriteContext
-
-
Constructor Summary
Constructors Constructor Description MarshallingContext(Transaction trans, ObjectReference ref, UpdateDepth updateDepth, boolean isNew)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddIndexEntry(FieldMetadata fieldMetadata, java.lang.Object obj)SlotallocateNewSlot(int length)Pointer4allocateSlot()voidbeginSlot()ReadBufferbuffer()Config4ClassclassConfiguration()ClassMetadataclassMetadata()ObjectContainerBasecontainer()voidcreateChildBuffer(boolean storeLengthInLink)voidcreateIndirectionWithinSlot()voidcreateIndirectionWithinSlot(TypeHandler4 handler)java.lang.ObjectcurrentIndexEntry()MarshallingContextStatecurrentState()voiddebugPrependNextWrite(ByteArrayBuffer prepend)voiddebugWriteEnd(byte b)intdeclaredAspectCount()voiddeclaredAspectCount(int count)java.lang.ObjectgetObject()booleanisNew()booleanisNull(int fieldIndex)voidisNull(int fieldIndex, boolean flag)intmarshalledLength()ObjectContainerobjectContainer()intobjectID()voidpurgeFieldIndexEntriesOnUpdate(Transaction transaction, ArrayType arrayType)ObjectReferencereference()intrequiredLength(MarshallingBuffer buffer, boolean align)ReservedBufferreserve(int length)reserves a buffer with a specific length at the current position, to be written in a later step.voidrestoreState(MarshallingContextState state)ByteArrayBuffertoWriteBuffer(Pointer4 pointer)Transactiontransaction()UpdateDepthupdateDepth()voidupdateDepth(UpdateDepth depth)voidwriteByte(byte b)writes a single byte to the buffer.voidwriteBytes(byte[] bytes)writes an array of bytes to the buffervoidwriteDeclaredAspectCount(int count)voidwriteInt(int i)writes an int to the buffer.voidwriteLong(long l)writes a long to the buffervoidwriteObject(TypeHandler4 handler, java.lang.Object obj)writes sub-objects, in cases where theTypeHandler4is known.voidwriteObject(java.lang.Object obj)makes sure the object is stored and writes the ID of the object to the context.voidwriteObjectWithCurrentState(TypeHandler4 handler, java.lang.Object obj)
-
-
-
Constructor Detail
-
MarshallingContext
public MarshallingContext(Transaction trans, ObjectReference ref, UpdateDepth updateDepth, boolean isNew)
-
-
Method Detail
-
classMetadata
public ClassMetadata classMetadata()
- Specified by:
classMetadatain interfaceMarshallingInfo
-
isNew
public boolean isNew()
-
isNull
public boolean isNull(int fieldIndex)
- Specified by:
isNullin interfaceMarshallingInfo
-
isNull
public void isNull(int fieldIndex, boolean flag)
-
transaction
public Transaction transaction()
- Specified by:
transactionin interfaceContext
-
allocateNewSlot
public Slot allocateNewSlot(int length)
-
allocateSlot
public Pointer4 allocateSlot()
-
toWriteBuffer
public ByteArrayBuffer toWriteBuffer(Pointer4 pointer)
-
marshalledLength
public int marshalledLength()
-
requiredLength
public int requiredLength(MarshallingBuffer buffer, boolean align)
-
getObject
public java.lang.Object getObject()
-
classConfiguration
public Config4Class classConfiguration()
-
updateDepth
public UpdateDepth updateDepth()
-
updateDepth
public void updateDepth(UpdateDepth depth)
-
objectID
public int objectID()
-
currentIndexEntry
public java.lang.Object currentIndexEntry()
-
container
public ObjectContainerBase container()
-
objectContainer
public ObjectContainer objectContainer()
- Specified by:
objectContainerin interfaceContext
-
writeByte
public void writeByte(byte b)
Description copied from interface:WriteBufferwrites a single byte to the buffer.- Specified by:
writeBytein interfaceWriteBuffer- Parameters:
b- the byte
-
writeBytes
public void writeBytes(byte[] bytes)
Description copied from interface:WriteBufferwrites an array of bytes to the buffer- Specified by:
writeBytesin interfaceWriteBuffer- Parameters:
bytes- the byte array
-
writeInt
public void writeInt(int i)
Description copied from interface:WriteBufferwrites an int to the buffer.- Specified by:
writeIntin interfaceWriteBuffer- Parameters:
i- the int
-
writeLong
public void writeLong(long l)
Description copied from interface:WriteBufferwrites a long to the buffer- Specified by:
writeLongin interfaceWriteBuffer- Parameters:
l- the long
-
createChildBuffer
public void createChildBuffer(boolean storeLengthInLink)
-
beginSlot
public void beginSlot()
- Specified by:
beginSlotin interfaceMarshallingInfo
-
writeDeclaredAspectCount
public void writeDeclaredAspectCount(int count)
-
debugPrependNextWrite
public void debugPrependNextWrite(ByteArrayBuffer prepend)
-
debugWriteEnd
public void debugWriteEnd(byte b)
-
writeObject
public void writeObject(java.lang.Object obj)
Description copied from interface:WriteContextmakes sure the object is stored and writes the ID of the object to the context. Use this method for first class objects only (objects that have an identity in the database). If the object can potentially be a primitive type, do not use this method but use a matchingWriteBuffermethod instead.- Specified by:
writeObjectin interfaceWriteContext- Parameters:
obj- the object to write.
-
writeObject
public void writeObject(TypeHandler4 handler, java.lang.Object obj)
Description copied from interface:WriteContextwrites sub-objects, in cases where theTypeHandler4is known.- Specified by:
writeObjectin interfaceWriteContext- Parameters:
handler- typehandler to be used to write the object.obj- the object to write
-
writeObjectWithCurrentState
public void writeObjectWithCurrentState(TypeHandler4 handler, java.lang.Object obj)
-
addIndexEntry
public void addIndexEntry(FieldMetadata fieldMetadata, java.lang.Object obj)
-
purgeFieldIndexEntriesOnUpdate
public void purgeFieldIndexEntriesOnUpdate(Transaction transaction, ArrayType arrayType)
-
reference
public ObjectReference reference()
-
createIndirectionWithinSlot
public void createIndirectionWithinSlot(TypeHandler4 handler)
-
createIndirectionWithinSlot
public void createIndirectionWithinSlot()
-
buffer
public ReadBuffer buffer()
- Specified by:
bufferin interfaceMarshallingInfo
-
currentState
public MarshallingContextState currentState()
-
restoreState
public void restoreState(MarshallingContextState state)
-
reserve
public ReservedBuffer reserve(int length)
Description copied from interface:WriteContextreserves a buffer with a specific length at the current position, to be written in a later step.- Specified by:
reservein interfaceWriteContext- Parameters:
length- the length to be reserved.- Returns:
- the ReservedBuffer
-
declaredAspectCount
public int declaredAspectCount()
- Specified by:
declaredAspectCountin interfaceAspectVersionContext
-
declaredAspectCount
public void declaredAspectCount(int count)
- Specified by:
declaredAspectCountin interfaceAspectVersionContext
-
-