|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sleepycat.persist.impl.Format
com.sleepycat.persist.impl.ObjectArrayFormat
public class ObjectArrayFormat
An array of objects having a specified number of dimensions. All
multidimensional arrays are handled by this class, since even a primitive
array of more than one dimension is an array of objects, where the component
objects may be primitive arrays. The PrimitiveArrayFormat
class
handles primitive arrays of one dimension only.
In this class, and PrimitiveArrayFormat
, we resort to using
reflection to allocate multidimensional arrays. If there is a need for it,
reflection could be avoided in the future by generating code as new array
formats are encountered.
Field Summary |
---|
Fields inherited from class com.sleepycat.persist.impl.Format |
---|
ID_BIGDEC, ID_BIGINT, ID_BOOL, ID_BOOL_W, ID_BYTE, ID_BYTE_W, ID_CHAR, ID_CHAR_W, ID_DATE, ID_DOUBLE, ID_DOUBLE_W, ID_FLOAT, ID_FLOAT_W, ID_INT, ID_INT_W, ID_LONG, ID_LONG_W, ID_NULL, ID_NUMBER, ID_OBJECT, ID_PREDEFINED, ID_SHORT, ID_SHORT_W, ID_SIMPLE_MAX, ID_SIMPLE_MIN, ID_STRING |
Constructor Summary | |
---|---|
ObjectArrayFormat(Catalog catalog,
Class type)
|
Method Summary | |
---|---|
(package private) void |
collectRelatedFormats(Catalog catalog,
Map<String,Format> newFormats)
Calls catalog.createFormat for formats that this format depends on, or that should also be persistent. |
(package private) Object |
convertRawObject(Catalog catalog,
boolean rawAccess,
RawObject rawObject,
IdentityHashMap converted)
Converts a RawObject to a current class object and adds the converted pair to the converted map. |
(package private) void |
copySecMultiKey(RecordInput input,
Format keyFormat,
Set results)
Called after skipToSecKey() to copy the data bytes of an array or collection (XXX_TO_MANY) key field. |
(package private) boolean |
evolve(Format newFormat,
Evolver evolver)
Called for an existing format that may not equal the current format for the same class. |
Format |
getComponentType()
Returns the array component type, or null if this is not an array type. |
int |
getDimensions()
Returns the number of array dimensions, or zero if this is not an array type. |
(package private) void |
initialize(Catalog catalog,
EntityModel model,
int initVersion)
Initializes an uninitialized format, initializing its related formats (superclass formats and array component formats) first. |
boolean |
isArray()
Returns whether this is an array type. |
(package private) boolean |
isAssignableTo(Format format)
Called by EntityOutput in rawAccess mode to determine whether an object type is allowed to be assigned to a given field type. |
(package private) Object |
newArray(int len)
Creates an array of the format's class of the given length, as if Array.newInstance(getType(), len) were called. |
Object |
newInstance(EntityInput input,
boolean rawAccess)
Creates a new instance of the target class using its default constructor. |
Object |
readObject(Object o,
EntityInput input,
boolean rawAccess)
Called after newInstance() to read the rest of the data bytes and fill in the object contents. |
(package private) void |
skipContents(RecordInput input)
Skips over the object's contents, as if readObject() were called, but without returning an object. |
(package private) void |
writeObject(Object o,
EntityOutput output,
boolean rawAccess)
Writes a given instance of the target class to the output data bytes. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
ObjectArrayFormat(Catalog catalog, Class type)
Method Detail |
---|
public boolean isArray()
RawType
RawObject
instances.
If true is returned, the array component type is returned by RawType.getComponentType()
and the number of array dimensions is returned by
RawType.getDimensions()
.
If false is returned, then this is a complex type, an enum type (see
RawType.isEnum()
), or a simple type (see RawType.isSimple()
).
isArray
in interface RawType
isArray
in class Format
public int getDimensions()
RawType
getDimensions
in interface RawType
getDimensions
in class Format
public Format getComponentType()
RawType
getComponentType
in interface RawType
getComponentType
in class Format
void collectRelatedFormats(Catalog catalog, Map<String,Format> newFormats)
Format
collectRelatedFormats
in class Format
void initialize(Catalog catalog, EntityModel model, int initVersion)
Format
initialize
in class Format
boolean isAssignableTo(Format format)
Format
isAssignableTo
in class Format
Object newArray(int len)
Format
newArray
in class Format
public Object newInstance(EntityInput input, boolean rawAccess)
Format
newInstance
in interface Reader
newInstance
in class Format
public Object readObject(Object o, EntityInput input, boolean rawAccess) throws RefreshException
Format
readObject
in interface Reader
readObject
in class Format
RefreshException
void writeObject(Object o, EntityOutput output, boolean rawAccess) throws RefreshException
Format
writeObject
in class Format
RefreshException
Object convertRawObject(Catalog catalog, boolean rawAccess, RawObject rawObject, IdentityHashMap converted) throws RefreshException
Format
convertRawObject
in class Format
RefreshException
void skipContents(RecordInput input) throws RefreshException
Format
skipContents
in class Format
RefreshException
void copySecMultiKey(RecordInput input, Format keyFormat, Set results) throws RefreshException
Format
copySecMultiKey
in class Format
RefreshException
boolean evolve(Format newFormat, Evolver evolver)
Format
If this method returns true, then it must have determined one of two things: - that the old and new formats are equal, and it must have called Evolver.useOldFormat; or - that the old format can be evolved to the new format, and it must have called Evolver.useEvolvedFormat.
If this method returns false, then it must have determined that the old format could not be evolved to the new format, and it must have called Evolver.addInvalidMutation, addMissingMutation or addEvolveError.
evolve
in class Format
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |