|
|||||||||
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.EnumFormat
public class EnumFormat
Format for all enum types. In this class we resort to using reflection to allocate arrays of enums. 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_OBJECT, ID_PREDEFINED, ID_SHORT, ID_SHORT_W, ID_SIMPLE_MAX, ID_SIMPLE_MIN, ID_STRING |
Constructor Summary | |
---|---|
EnumFormat(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. |
boolean |
equals(Object other)
Used to compare the current version and an old version, to determine whether class evolution is needed. |
List<String> |
getEnumConstants()
Returns an unmodifiable list of the names of the enum instances, or null if this is not an enum type. |
(package private) void |
initialize(Catalog catalog)
Initializes an uninitialized format, initializing its related formats (superclass formats and array component formats) first. |
boolean |
isEnum()
Returns whether this is an enum 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. |
(package private) Object |
newInstance(EntityInput input,
boolean rawAccess)
Creates a new instance of the target class using its default constructor. |
(package private) void |
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(EntityInput 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 com.sleepycat.persist.impl.Format |
---|
copySecKey, copySecMultiKey, evolveTo, getClassMetadata, getClassName, getComponentType, getDimensions, getEntityFormat, getEntityMetadata, getFields, getId, getProxiedFormat, getSuperFormat, getSuperType, getType, getVersion, getWrapperFormat, initializeIfNeeded, isArray, isAssignableTo, isCurrentVersion, isEntity, isModelClass, isPredefined, isPriKeyNullOrZero, isPrimitive, isSimple, nullifySecKey, readPriKey, setId, setProxiedFormat, setSuperFormat, skipToSecKey, writePriKey |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
EnumFormat(Class type)
Method Detail |
---|
public boolean isEnum()
RawType
If true is returned, a value of this type is a RawObject
and
the enum constant String is available via RawObject.getEnum()
.
If false is returned, then this is a complex type, an array type (see
RawType.isArray()
), or a simple type (see RawType.isSimple()
).
isEnum
in interface RawType
isEnum
in class Format
public List<String> getEnumConstants()
RawType
getEnumConstants
in interface RawType
getEnumConstants
in class Format
void collectRelatedFormats(Catalog catalog, Map<String,Format> newFormats)
Format
collectRelatedFormats
in class Format
void initialize(Catalog catalog)
Format
initialize
in class Format
Object newArray(int len)
Format
newArray
in class Format
Object newInstance(EntityInput input, boolean rawAccess)
Format
newInstance
in class Format
void writeObject(Object o, EntityOutput output, boolean rawAccess)
Format
writeObject
in class Format
void readObject(Object o, EntityInput input, boolean rawAccess)
Format
readObject
in class Format
void skipContents(EntityInput input)
Format
skipContents
in class Format
public boolean equals(Object other)
Format
equals
in class Format
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |