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 Iterator4allElements(ObjectContainerBase container, java.lang.Object a_object)static Iterator4allElements(ReflectArray reflectArray, java.lang.Object array)protected voidanalyze(ObjectContainerBase container, java.lang.Object obj, ArrayInfo info)protected voidanalyzeDimensions(ObjectContainerBase container, java.lang.Object obj, ArrayInfo info)protected ReflectArrayarrayReflector(ObjectContainerBase container)voidcascadeActivation(ActivationContext context)will be called during activation if the handled object is already activeprotected intclassIDFromInfo(ObjectContainerBase container, ArrayInfo info)intclassIdToMarshalledClassId(int classID, boolean primitive)protected ReflectClassclassReflector(Reflector reflector, ClassMetadata classMetadata, boolean isPrimitive)voidcollectIDs(QueryingReadContext context)will be called during querying to ask for IDs of member objects of the handled object.protected ArrayVersionHelpercreateVersionHelper()java.lang.ObjectdeepClone(java.lang.Object context)The parameter allows passing one new object so parent references can be corrected on children.voiddefragment(DefragmentContext context)gets called when an object gets defragmented.voiddefragmentSlot(DefragmentContext context)TypeHandler4delegateTypeHandler()voiddelete(DeleteContext context)gets called when an object gets deleted.voiddeletePrimitiveEmbedded(StatefulBuffer buffer, PrimitiveTypeMetadata classPrimitive)booleandescendsIntoMembers()booleanequals(java.lang.Object obj)protected ArrayInfoforEachElement(AbstractBufferContext context, java.lang.Runnable elementRunnable)protected booleanhandleAsByteArray(BufferContext context)protected booleanhandleAsByteArray(java.lang.Object obj)inthashCode()protected booleanhasNullBitmap(ArrayInfo info)byteidentifier()protected booleanisPreVersion0Format(int elementCount)protected booleanisPrimitive(Reflector reflector, ReflectClass claxx, ClassMetadata classMetadata)static Iterator4iterator(ReflectClass claxx, java.lang.Object obj)intlinkLength()protected ArrayInfonewArrayInfo()protected java.lang.ObjectnewInstance(ReflectArray arrayReflector, ArrayInfo info, ReflectClass clazz)protected ReflectClassnewInstanceReflectClass(Reflector reflector, ArrayInfo info)protected BitMap4nullItemsMap(ReflectArray reflector, java.lang.Object array)PreparedComparisonprepareComparison(Context context, java.lang.Object obj)creates a prepared comparison to compare multiple objects against one single object.ReflectClassprimitiveClassReflector(Reflector reflector)java.lang.Objectread(ReadContext context)gets called when an value type is to be read from the database.TypeHandler4readCandidateHandler(QueryingReadContext context)will be called during querying to ask for the handler to be used to collect children of the handled objectprotected java.lang.ObjectreadCreate(Transaction trans, ReadBuffer buffer, ArrayInfo info)protected voidreadDimensions(ArrayInfo info, ReadBuffer buffer)protected voidreadElements(ReadContext context, ArrayInfo info, java.lang.Object array)protected voidreadInfo(Transaction trans, ReadBuffer buffer, ArrayInfo info)protected voidreadInto(ReadContext context, ArrayInfo info, java.lang.Object array)protected BitMap4readNullBitmap(ReadBuffer context, int length)java.lang.StringtoString()TypeHandler4unversionedTemplate()protected booleanuseJavaHandling()protected voidwithContent(AbstractBufferContext context, java.lang.Runnable runnable)voidwrite(WriteContext context, java.lang.Object obj)gets called when an object is to be written to the database.protected voidwriteDimensions(WriteContext context, ArrayInfo info)protected voidwriteElements(WriteContext context, java.lang.Object obj, ArrayInfo info)protected voidwriteInfo(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:CascadingTypeHandlerwill be called during activation if the handled object is already active- Specified by:
cascadeActivationin interfaceCascadingTypeHandler
-
collectIDs
public void collectIDs(QueryingReadContext context)
Description copied from interface:CascadingTypeHandlerwill be called during querying to ask for IDs of member objects of the handled object.- Specified by:
collectIDsin 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:TypeHandler4gets called when an object gets deleted.- Specified by:
deletein interfaceTypeHandler4- Throws:
Db4oIOException
-
deletePrimitiveEmbedded
public final void deletePrimitiveEmbedded(StatefulBuffer buffer, PrimitiveTypeMetadata classPrimitive)
- Parameters:
classPrimitive-
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein 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:CascadingTypeHandlerwill be called during querying to ask for the handler to be used to collect children of the handled object- Specified by:
readCandidateHandlerin 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:TypeHandler4gets called when an object gets defragmented.- Specified by:
defragmentin 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:ValueTypeHandlergets called when an value type is to be read from the database.- Specified by:
readin 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:TypeHandler4gets called when an object is to be written to the database.- Specified by:
writein interfaceTypeHandler4obj- 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:Comparable4creates a prepared comparison to compare multiple objects against one single object.- Specified by:
prepareComparisonin 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:
unversionedTemplatein interfaceVersionedTypeHandler
-
deepClone
public java.lang.Object deepClone(java.lang.Object context)
Description copied from interface:DeepCloneThe 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:
toStringin classjava.lang.Object
-
descendsIntoMembers
public boolean descendsIntoMembers()
- Specified by:
descendsIntoMembersin interfaceQueryableTypeHandler
-
-