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 void
addIndexEntry(FieldMetadata fieldMetadata, java.lang.Object obj)
Slot
allocateNewSlot(int length)
Pointer4
allocateSlot()
void
beginSlot()
ReadBuffer
buffer()
Config4Class
classConfiguration()
ClassMetadata
classMetadata()
ObjectContainerBase
container()
void
createChildBuffer(boolean storeLengthInLink)
void
createIndirectionWithinSlot()
void
createIndirectionWithinSlot(TypeHandler4 handler)
java.lang.Object
currentIndexEntry()
MarshallingContextState
currentState()
void
debugPrependNextWrite(ByteArrayBuffer prepend)
void
debugWriteEnd(byte b)
int
declaredAspectCount()
void
declaredAspectCount(int count)
java.lang.Object
getObject()
boolean
isNew()
boolean
isNull(int fieldIndex)
void
isNull(int fieldIndex, boolean flag)
int
marshalledLength()
ObjectContainer
objectContainer()
int
objectID()
void
purgeFieldIndexEntriesOnUpdate(Transaction transaction, ArrayType arrayType)
ObjectReference
reference()
int
requiredLength(MarshallingBuffer buffer, boolean align)
ReservedBuffer
reserve(int length)
reserves a buffer with a specific length at the current position, to be written in a later step.void
restoreState(MarshallingContextState state)
ByteArrayBuffer
toWriteBuffer(Pointer4 pointer)
Transaction
transaction()
UpdateDepth
updateDepth()
void
updateDepth(UpdateDepth depth)
void
writeByte(byte b)
writes a single byte to the buffer.void
writeBytes(byte[] bytes)
writes an array of bytes to the buffervoid
writeDeclaredAspectCount(int count)
void
writeInt(int i)
writes an int to the buffer.void
writeLong(long l)
writes a long to the buffervoid
writeObject(TypeHandler4 handler, java.lang.Object obj)
writes sub-objects, in cases where theTypeHandler4
is known.void
writeObject(java.lang.Object obj)
makes sure the object is stored and writes the ID of the object to the context.void
writeObjectWithCurrentState(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:
classMetadata
in interfaceMarshallingInfo
-
isNew
public boolean isNew()
-
isNull
public boolean isNull(int fieldIndex)
- Specified by:
isNull
in interfaceMarshallingInfo
-
isNull
public void isNull(int fieldIndex, boolean flag)
-
transaction
public Transaction transaction()
- Specified by:
transaction
in 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:
objectContainer
in interfaceContext
-
writeByte
public void writeByte(byte b)
Description copied from interface:WriteBuffer
writes a single byte to the buffer.- Specified by:
writeByte
in interfaceWriteBuffer
- Parameters:
b
- the byte
-
writeBytes
public void writeBytes(byte[] bytes)
Description copied from interface:WriteBuffer
writes an array of bytes to the buffer- Specified by:
writeBytes
in interfaceWriteBuffer
- Parameters:
bytes
- the byte array
-
writeInt
public void writeInt(int i)
Description copied from interface:WriteBuffer
writes an int to the buffer.- Specified by:
writeInt
in interfaceWriteBuffer
- Parameters:
i
- the int
-
writeLong
public void writeLong(long l)
Description copied from interface:WriteBuffer
writes a long to the buffer- Specified by:
writeLong
in interfaceWriteBuffer
- Parameters:
l
- the long
-
createChildBuffer
public void createChildBuffer(boolean storeLengthInLink)
-
beginSlot
public void beginSlot()
- Specified by:
beginSlot
in 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:WriteContext
makes 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 matchingWriteBuffer
method instead.- Specified by:
writeObject
in interfaceWriteContext
- Parameters:
obj
- the object to write.
-
writeObject
public void writeObject(TypeHandler4 handler, java.lang.Object obj)
Description copied from interface:WriteContext
writes sub-objects, in cases where theTypeHandler4
is known.- Specified by:
writeObject
in 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:
buffer
in interfaceMarshallingInfo
-
currentState
public MarshallingContextState currentState()
-
restoreState
public void restoreState(MarshallingContextState state)
-
reserve
public ReservedBuffer reserve(int length)
Description copied from interface:WriteContext
reserves a buffer with a specific length at the current position, to be written in a later step.- Specified by:
reserve
in interfaceWriteContext
- Parameters:
length
- the length to be reserved.- Returns:
- the ReservedBuffer
-
declaredAspectCount
public int declaredAspectCount()
- Specified by:
declaredAspectCount
in interfaceAspectVersionContext
-
declaredAspectCount
public void declaredAspectCount(int count)
- Specified by:
declaredAspectCount
in interfaceAspectVersionContext
-
-