Package com.db4o.internal.handlers.array
Class ArrayHandler
- java.lang.Object
-
- com.db4o.internal.handlers.array.ArrayHandler
-
- All Implemented Interfaces:
DeepClone
,Comparable4
,VariableLengthTypeHandler
,VersionedTypeHandler
,CascadingTypeHandler
,QueryableTypeHandler
,TypeHandler4
,ValueTypeHandler
- Direct Known Subclasses:
ArrayHandler5
,MultidimensionalArrayHandler
public class ArrayHandler extends java.lang.Object implements CascadingTypeHandler, Comparable4, ValueTypeHandler, VariableLengthTypeHandler, VersionedTypeHandler, QueryableTypeHandler
This is the latest version, the one that should be used.
-
-
Field Summary
Fields Modifier and Type Field Description protected ArrayVersionHelper
_versionHelper
-
Constructor Summary
Constructors Constructor Description ArrayHandler()
ArrayHandler(TypeHandler4 handler, boolean usePrimitiveClassReflector)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Iterator4
allElements(ObjectContainerBase container, java.lang.Object a_object)
static Iterator4
allElements(ReflectArray reflectArray, java.lang.Object array)
protected void
analyze(ObjectContainerBase container, java.lang.Object obj, ArrayInfo info)
protected void
analyzeDimensions(ObjectContainerBase container, java.lang.Object obj, ArrayInfo info)
protected ReflectArray
arrayReflector(ObjectContainerBase container)
void
cascadeActivation(ActivationContext context)
will be called during activation if the handled object is already activeprotected int
classIDFromInfo(ObjectContainerBase container, ArrayInfo info)
int
classIdToMarshalledClassId(int classID, boolean primitive)
protected ReflectClass
classReflector(Reflector reflector, ClassMetadata classMetadata, boolean isPrimitive)
void
collectIDs(QueryingReadContext context)
will be called during querying to ask for IDs of member objects of the handled object.protected ArrayVersionHelper
createVersionHelper()
java.lang.Object
deepClone(java.lang.Object context)
The parameter allows passing one new object so parent references can be corrected on children.void
defragment(DefragmentContext context)
gets called when an object gets defragmented.void
defragmentSlot(DefragmentContext context)
TypeHandler4
delegateTypeHandler()
void
delete(DeleteContext context)
gets called when an object gets deleted.void
deletePrimitiveEmbedded(StatefulBuffer buffer, PrimitiveTypeMetadata classPrimitive)
boolean
descendsIntoMembers()
boolean
equals(java.lang.Object obj)
protected ArrayInfo
forEachElement(AbstractBufferContext context, java.lang.Runnable elementRunnable)
protected boolean
handleAsByteArray(BufferContext context)
protected boolean
handleAsByteArray(java.lang.Object obj)
int
hashCode()
protected boolean
hasNullBitmap(ArrayInfo info)
byte
identifier()
protected boolean
isPreVersion0Format(int elementCount)
protected boolean
isPrimitive(Reflector reflector, ReflectClass claxx, ClassMetadata classMetadata)
static Iterator4
iterator(ReflectClass claxx, java.lang.Object obj)
int
linkLength()
protected ArrayInfo
newArrayInfo()
protected java.lang.Object
newInstance(ReflectArray arrayReflector, ArrayInfo info, ReflectClass clazz)
protected ReflectClass
newInstanceReflectClass(Reflector reflector, ArrayInfo info)
protected BitMap4
nullItemsMap(ReflectArray reflector, java.lang.Object array)
PreparedComparison
prepareComparison(Context context, java.lang.Object obj)
creates a prepared comparison to compare multiple objects against one single object.ReflectClass
primitiveClassReflector(Reflector reflector)
java.lang.Object
read(ReadContext context)
gets called when an value type is to be read from the database.TypeHandler4
readCandidateHandler(QueryingReadContext context)
will be called during querying to ask for the handler to be used to collect children of the handled objectprotected java.lang.Object
readCreate(Transaction trans, ReadBuffer buffer, ArrayInfo info)
protected void
readDimensions(ArrayInfo info, ReadBuffer buffer)
protected void
readElements(ReadContext context, ArrayInfo info, java.lang.Object array)
protected void
readInfo(Transaction trans, ReadBuffer buffer, ArrayInfo info)
protected void
readInto(ReadContext context, ArrayInfo info, java.lang.Object array)
protected BitMap4
readNullBitmap(ReadBuffer context, int length)
java.lang.String
toString()
TypeHandler4
unversionedTemplate()
protected boolean
useJavaHandling()
protected void
withContent(AbstractBufferContext context, java.lang.Runnable runnable)
void
write(WriteContext context, java.lang.Object obj)
gets called when an object is to be written to the database.protected void
writeDimensions(WriteContext context, ArrayInfo info)
protected void
writeElements(WriteContext context, java.lang.Object obj, ArrayInfo info)
protected void
writeInfo(WriteContext context, ArrayInfo info)
-
-
-
Field Detail
-
_versionHelper
protected final ArrayVersionHelper _versionHelper
-
-
Constructor Detail
-
ArrayHandler
public ArrayHandler()
-
ArrayHandler
public ArrayHandler(TypeHandler4 handler, boolean usePrimitiveClassReflector)
-
-
Method Detail
-
createVersionHelper
protected ArrayVersionHelper createVersionHelper()
-
arrayReflector
protected ReflectArray arrayReflector(ObjectContainerBase container)
-
allElements
public Iterator4 allElements(ObjectContainerBase container, java.lang.Object a_object)
-
allElements
public static Iterator4 allElements(ReflectArray reflectArray, java.lang.Object array)
-
cascadeActivation
public final void cascadeActivation(ActivationContext context)
Description copied from interface:CascadingTypeHandler
will be called during activation if the handled object is already active- Specified by:
cascadeActivation
in interfaceCascadingTypeHandler
-
collectIDs
public void collectIDs(QueryingReadContext context)
Description copied from interface:CascadingTypeHandler
will be called during querying to ask for IDs of member objects of the handled object.- Specified by:
collectIDs
in interfaceCascadingTypeHandler
-
forEachElement
protected ArrayInfo forEachElement(AbstractBufferContext context, java.lang.Runnable elementRunnable)
-
withContent
protected void withContent(AbstractBufferContext context, java.lang.Runnable runnable)
-
delete
public void delete(DeleteContext context) throws Db4oIOException
Description copied from interface:TypeHandler4
gets called when an object gets deleted.- Specified by:
delete
in interfaceTypeHandler4
- Throws:
Db4oIOException
-
deletePrimitiveEmbedded
public final void deletePrimitiveEmbedded(StatefulBuffer buffer, PrimitiveTypeMetadata classPrimitive)
- Parameters:
classPrimitive
-
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
handleAsByteArray
protected boolean handleAsByteArray(java.lang.Object obj)
-
identifier
public byte identifier()
-
primitiveClassReflector
public ReflectClass primitiveClassReflector(Reflector reflector)
-
readCreate
protected java.lang.Object readCreate(Transaction trans, ReadBuffer buffer, ArrayInfo info)
-
newInstance
protected final java.lang.Object newInstance(ReflectArray arrayReflector, ArrayInfo info, ReflectClass clazz)
-
newInstanceReflectClass
protected final ReflectClass newInstanceReflectClass(Reflector reflector, ArrayInfo info)
-
readCandidateHandler
public TypeHandler4 readCandidateHandler(QueryingReadContext context)
Description copied from interface:CascadingTypeHandler
will be called during querying to ask for the handler to be used to collect children of the handled object- Specified by:
readCandidateHandler
in interfaceCascadingTypeHandler
- Returns:
-
readInfo
protected void readInfo(Transaction trans, ReadBuffer buffer, ArrayInfo info)
-
readDimensions
protected void readDimensions(ArrayInfo info, ReadBuffer buffer)
-
isPreVersion0Format
protected boolean isPreVersion0Format(int elementCount)
-
classReflector
protected final ReflectClass classReflector(Reflector reflector, ClassMetadata classMetadata, boolean isPrimitive)
-
iterator
public static Iterator4 iterator(ReflectClass claxx, java.lang.Object obj)
-
useJavaHandling
protected boolean useJavaHandling()
-
classIDFromInfo
protected int classIDFromInfo(ObjectContainerBase container, ArrayInfo info)
-
classIdToMarshalledClassId
public final int classIdToMarshalledClassId(int classID, boolean primitive)
-
isPrimitive
protected final boolean isPrimitive(Reflector reflector, ReflectClass claxx, ClassMetadata classMetadata)
-
defragment
public void defragment(DefragmentContext context)
Description copied from interface:TypeHandler4
gets called when an object gets defragmented.- Specified by:
defragment
in interfaceTypeHandler4
-
defragmentSlot
public final void defragmentSlot(DefragmentContext context)
-
handleAsByteArray
protected boolean handleAsByteArray(BufferContext context)
-
read
public java.lang.Object read(ReadContext context)
Description copied from interface:ValueTypeHandler
gets called when an value type is to be read from the database.- Specified by:
read
in interfaceValueTypeHandler
- Returns:
- the read value type
-
readElements
protected void readElements(ReadContext context, ArrayInfo info, java.lang.Object array)
-
newArrayInfo
protected ArrayInfo newArrayInfo()
-
readInto
protected final void readInto(ReadContext context, ArrayInfo info, java.lang.Object array)
-
readNullBitmap
protected BitMap4 readNullBitmap(ReadBuffer context, int length)
-
hasNullBitmap
protected final boolean hasNullBitmap(ArrayInfo info)
-
write
public void write(WriteContext context, java.lang.Object obj)
Description copied from interface:TypeHandler4
gets called when an object is to be written to the database.- Specified by:
write
in interfaceTypeHandler4
obj
- the object
-
writeElements
protected void writeElements(WriteContext context, java.lang.Object obj, ArrayInfo info)
-
writeInfo
protected void writeInfo(WriteContext context, ArrayInfo info)
-
writeDimensions
protected void writeDimensions(WriteContext context, ArrayInfo info)
-
analyze
protected final void analyze(ObjectContainerBase container, java.lang.Object obj, ArrayInfo info)
-
analyzeDimensions
protected void analyzeDimensions(ObjectContainerBase container, java.lang.Object obj, ArrayInfo info)
-
nullItemsMap
protected BitMap4 nullItemsMap(ReflectArray reflector, java.lang.Object array)
-
prepareComparison
public PreparedComparison prepareComparison(Context context, java.lang.Object obj)
Description copied from interface:Comparable4
creates a prepared comparison to compare multiple objects against one single object.- Specified by:
prepareComparison
in interfaceComparable4
- Parameters:
context
- the context of the comparisonobj
- the object that is to be compared against multiple other objects- Returns:
- the prepared comparison
-
linkLength
public int linkLength()
-
unversionedTemplate
public TypeHandler4 unversionedTemplate()
- Specified by:
unversionedTemplate
in interfaceVersionedTypeHandler
-
deepClone
public java.lang.Object deepClone(java.lang.Object context)
Description copied from interface:DeepClone
The parameter allows passing one new object so parent references can be corrected on children.
-
delegateTypeHandler
public TypeHandler4 delegateTypeHandler()
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
descendsIntoMembers
public boolean descendsIntoMembers()
- Specified by:
descendsIntoMembers
in interfaceQueryableTypeHandler
-
-