public class ComplexFormat extends 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 and Description |
|---|
ComplexFormat(Catalog catalog,
java.lang.Class cls,
ClassMetadata clsMeta,
EntityMetadata entityMeta) |
| Modifier and Type | Method and Description |
|---|---|
(package private) void |
collectRelatedFormats(Catalog catalog,
java.util.Map<java.lang.String,Format> newFormats)
Calls catalog.createFormat for formats that this format depends on, or
that should also be persistent.
|
(package private) java.lang.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,
java.util.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 newFormatParam,
Evolver evolver)
Called for an existing format that may not equal the current format for
the same class.
|
(package private) boolean |
evolveMetadata(Format newFormatParam,
Converter converter,
Evolver evolver)
Called when a Converter handles evolution of a class, but we may still
need to evolve the metadata.
|
Accessor |
getAccessor(boolean rawAccess) |
ClassMetadata |
getClassMetadata()
Returns the original model class metadata used to create this class, or
null if this is not a model class.
|
(package private) ComplexFormat |
getComplexSuper()
Returns getSuperFormat cast to ComplexFormat.
|
(package private) ComplexFormat |
getEntityFormat()
For an entity class or subclass, returns the base entity class; returns
null in other cases.
|
EntityMetadata |
getEntityMetadata()
Returns the original model entity metadata used to create this class, or
null if this is not an entity class.
|
(package private) boolean |
getEvolveNeeded()
Overridden by ComplexFormat.
|
java.util.Map<java.lang.String,RawField> |
getFields()
Returns a map of field name to raw field for each non-static
non-transient field declared in this class, or null if this is not a
complex type (in other words, this is a simple type or an array type).
|
java.util.Set<java.lang.String> |
getIncorrectlyOrderedSecKeys()
For unit testing.
|
(package private) boolean |
getNewStringFormat()
For an entity format, returns whether the entity was written using the
new String format.
|
java.lang.String |
getOldKeyName(java.lang.String keyName)
For an entity class or subclass, returns the old key name for the given
key name that has been renamed, or returns the given key name if it has
not been renamed.
|
(package private) java.lang.String |
getPriKeyField() |
(package private) FieldInfo |
getPriKeyFieldInfo() |
(package private) static SecondaryKeyMetadata |
getSecondaryKeyMetadataByFieldName(java.util.Map<java.lang.String,SecondaryKeyMetadata> secKeys,
java.lang.String fieldName)
The secondary key metadata map (ClassMetadata.getSecondaryKeys) is keyed
by key name, not field name.
|
(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.
|
(package private) boolean |
isEntity()
Returns whether this format class is an entity class.
|
(package private) boolean |
isModelClass()
Returns whether this class is present in the EntityModel.
|
(package private) boolean |
isPriKeyNullOrZero(java.lang.Object o,
boolean rawAccess)
Returns whether the entity's primary key field is null or zero, as
defined for primary keys that are assigned from a sequence.
|
(package private) boolean |
isSecKeyIncorrectlyOrdered(java.lang.String keyName)
Called when opening an existing secondary database that should have a
dup comparator configured.
|
(package private) void |
migrateFromBeta(java.util.Map<java.lang.String,Format> formatMap)
Special handling for JE 3.0.12 beta formats.
|
(package private) java.lang.Object |
newArray(int len)
Creates an array of the format's class of the given length, as if
Array.newInstance(getType(), len) were called.
|
java.lang.Object |
newInstance(EntityInput input,
boolean rawAccess)
Creates a new instance of the target class using its default
constructor.
|
(package private) boolean |
nullifySecKey(Catalog catalog,
java.lang.Object entity,
java.lang.String keyName,
java.lang.Object keyElement)
Nullifies the given key field in the given RawObject -- rawAccess mode
is implied.
|
java.lang.Object |
readObject(java.lang.Object o,
EntityInput input,
boolean rawAccess)
Called after newInstance() to read the rest of the data bytes and fill
in the object contents.
|
void |
readPriKey(java.lang.Object o,
EntityInput input,
boolean rawAccess)
Reads the primary key from the given input bytes and sets the primary
key field in the given object.
|
(package private) void |
setEvolveNeeded(boolean needed)
Called by the Evolver with true when an entity format or any of its
nested format were changed.
|
(package private) boolean |
setSecKeyCorrectlyOrdered(java.lang.String keyName)
Called when creating a new secondary database that should have a dup
comparator configured.
|
(package private) void |
skipContents(RecordInput input)
Skips over the object's contents, as if readObject() were called, but
without returning an object.
|
(package private) Format |
skipToSecKey(RecordInput input,
java.lang.String keyName)
When extracting a secondary key, called to skip over all fields up to
the given secondary key field.
|
(package private) void |
writeObject(java.lang.Object o,
EntityOutput output,
boolean rawAccess)
Writes a given instance of the target class to the output data bytes.
|
(package private) void |
writePriKey(java.lang.Object o,
EntityOutput output,
boolean rawAccess)
Gets the primary key field from the given object and writes it to the
given output data bytes.
|
allowEvolveFromProxy, areNestedRefsProhibited, copySecKey, getCatalog, getClassName, getComponentType, getDimensions, getEnumConstants, getExistingType, getId, getLatestVersion, getPreviousVersion, getProxiedFormat, getReader, getSequenceKeyFormat, getSuperFormat, getSuperType, getType, getVersion, getWrapperFormat, initCatalog, initializeIfNeeded, initializeReader, isArray, isAssignableTo, isCurrentVersion, isDeleted, isEnum, isInitialized, isNew, isPredefined, isPrimitive, isSameClass, isSimple, setDeleted, setId, setLatestVersion, setProxiedFormat, setReader, setSuperFormat, setUnused, toStringComplexFormat(Catalog catalog, java.lang.Class cls, ClassMetadata clsMeta, EntityMetadata entityMeta)
void migrateFromBeta(java.util.Map<java.lang.String,Format> formatMap)
FormatmigrateFromBeta in class FormatComplexFormat getComplexSuper()
FieldInfo getPriKeyFieldInfo()
java.lang.String getPriKeyField()
boolean isEntity()
Formatboolean isModelClass()
FormatisModelClass in class Formatpublic ClassMetadata getClassMetadata()
RawTypegetClassMetadata in interface RawTypegetClassMetadata in class Formatpublic EntityMetadata getEntityMetadata()
RawTypegetEntityMetadata in interface RawTypegetEntityMetadata in class FormatComplexFormat getEntityFormat()
FormatgetEntityFormat in class Formatvoid setEvolveNeeded(boolean needed)
FormatsetEvolveNeeded in class Formatboolean getEvolveNeeded()
FormatgetEvolveNeeded in class Formatboolean getNewStringFormat()
FormatgetNewStringFormat in class Formatpublic java.util.Map<java.lang.String,RawField> getFields()
RawTypevoid collectRelatedFormats(Catalog catalog, java.util.Map<java.lang.String,Format> newFormats)
FormatcollectRelatedFormats in class Formatvoid initialize(Catalog catalog, EntityModel model, int initVersion)
Formatinitialize in class Formatjava.lang.Object newArray(int len)
Formatpublic java.lang.Object newInstance(EntityInput input, boolean rawAccess)
FormatnewInstance in interface ReadernewInstance in class Formatpublic java.lang.Object readObject(java.lang.Object o,
EntityInput input,
boolean rawAccess)
throws RefreshException
FormatreadObject in interface ReaderreadObject in class FormatRefreshExceptionvoid writeObject(java.lang.Object o,
EntityOutput output,
boolean rawAccess)
throws RefreshException
FormatwriteObject in class FormatRefreshExceptionjava.lang.Object convertRawObject(Catalog catalog, boolean rawAccess, RawObject rawObject, IdentityHashMap converted) throws RefreshException
FormatconvertRawObject in class FormatRefreshExceptionboolean isPriKeyNullOrZero(java.lang.Object o,
boolean rawAccess)
FormatisPriKeyNullOrZero in class Formatvoid writePriKey(java.lang.Object o,
EntityOutput output,
boolean rawAccess)
throws RefreshException
FormatwritePriKey in class FormatRefreshExceptionpublic void readPriKey(java.lang.Object o,
EntityInput input,
boolean rawAccess)
throws RefreshException
FormatreadPriKey in interface ReaderreadPriKey in class FormatRefreshExceptionpublic java.lang.String getOldKeyName(java.lang.String keyName)
FormatgetOldKeyName in class Formatboolean nullifySecKey(Catalog catalog, java.lang.Object entity, java.lang.String keyName, java.lang.Object keyElement)
FormatnullifySecKey in class Formatvoid skipContents(RecordInput input) throws RefreshException
FormatskipContents in class FormatRefreshExceptionvoid copySecMultiKey(RecordInput input, Format keyFormat, java.util.Set results) throws RefreshException
FormatcopySecMultiKey in class FormatRefreshExceptionFormat skipToSecKey(RecordInput input, java.lang.String keyName) throws RefreshException
FormatskipToSecKey in class FormatRefreshExceptionboolean evolve(Format newFormatParam, Evolver evolver)
FormatIf 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.
boolean evolveMetadata(Format newFormatParam, Converter converter, Evolver evolver)
FormatevolveMetadata in class Formatstatic SecondaryKeyMetadata getSecondaryKeyMetadataByFieldName(java.util.Map<java.lang.String,SecondaryKeyMetadata> secKeys, java.lang.String fieldName)
boolean isSecKeyIncorrectlyOrdered(java.lang.String keyName)
boolean setSecKeyCorrectlyOrdered(java.lang.String keyName)
public java.util.Set<java.lang.String> getIncorrectlyOrderedSecKeys()
public Accessor getAccessor(boolean rawAccess)
getAccessor in interface ReadergetAccessor in class FormatCopyright (c) 2004-2012 Oracle. All rights reserved.