Package org.apache.openjpa.meta
Class ValueMetaDataImpl
java.lang.Object
org.apache.openjpa.meta.ValueMetaDataImpl
- All Implemented Interfaces:
Serializable
,MetaDataContext
,MetaDataModes
,ValueMetaData
- Direct Known Subclasses:
ValueMappingImpl
Default
ValueMetaData
implementation.- Author:
- Abe White
- See Also:
-
Field Summary
Fields inherited from interface org.apache.openjpa.meta.MetaDataModes
MODE_ALL, MODE_ANN_MAPPING, MODE_MAPPING, MODE_MAPPING_INIT, MODE_META, MODE_NONE, MODE_QUERY
Fields inherited from interface org.apache.openjpa.meta.ValueMetaData
CASCADE_AUTO, CASCADE_IMMEDIATE, CASCADE_NONE, MAPPED_BY_PK
-
Constructor Summary
ModifierConstructorDescriptionprotected
Constructor for serialization.protected
ValueMetaDataImpl
(FieldMetaData owner) -
Method Summary
Modifier and TypeMethodDescriptionAdd embedded metadata for this value.addEmbeddedMetaData
(int access) Add embedded metadata for this value with the given access typevoid
copy
(ValueMetaData vmd) Copy state from the given value to this one.int
Cascade behavior for attach operation.int
Cascade behavior for delete operation.int
Cascade behavior for detach operation.int
Cascade behavior for persist operation.int
Cascade behavior for refresh operation.Return the declared class of the value.int
Return the declared type code of the value.Return metadata for the value's class, if the type is persistent.The embedded class metadata for the value.Return the owning field for this value.Access metadata repository.int
Resolve mode for metadata.getType()
The value class.int
The type code of the value class.The metadata for the value class, if the type is persistent.User-supplied type overriding assumed type based on field.The field that this value shares a mapping with.The field that this value shares a mapping with.boolean
Whether the type is a persistence capable instance.boolean
This attribute is a hint to the implementation to store this value in the same structure as the class, rather than as a separate datastore structure.boolean
Whether this is an embedded persistence capable value.boolean
Whether this value is serialized when stored.boolean
isTypePC()
Whether the type is a persistence capable instance.boolean
resolve
(int mode) Resolve and validate metadata.void
setCascadeAttach
(int attach) Cascade behavior for attach operation.void
setCascadeDelete
(int delete) Cascade behavior for deletion.void
setCascadeDetach
(int detach) Cascade behavior for detach operation.void
setCascadePersist
(int persist) Cascade behavior for persist operation.void
setCascadePersist
(int persist, boolean checkPUDefault) Cascade behavior for persist operation.void
setCascadeRefresh
(int refresh) Cascade behavior for refresh operation.void
setDeclaredType
(Class type) Set the declared class of the value.void
setDeclaredTypeCode
(int code) Set the type code for the value.void
setEmbedded
(boolean embedded) This attribute is a hint to the implementation to store this value in the same structure as the class, rather than as a separate datastore structure.void
setResolve
(int mode) Resolve mode for metadata.void
setResolve
(int mode, boolean on) Resolve mode for metadata.void
setSerialized
(boolean serialized) Whether this value is serialized when stored.void
The value class.void
setTypeCode
(int code) The type code of the value class.void
setTypeOverride
(Class val) User-supplied type overriding assumed type based on field.void
setValueMappedBy
(String mapped) The field that this value shares a mapping with.toString()
-
Constructor Details
-
ValueMetaDataImpl
-
ValueMetaDataImpl
protected ValueMetaDataImpl()Constructor for serialization.
-
-
Method Details
-
getFieldMetaData
Description copied from interface:ValueMetaData
Return the owning field for this value.- Specified by:
getFieldMetaData
in interfaceValueMetaData
-
getRepository
Description copied from interface:MetaDataContext
Access metadata repository.- Specified by:
getRepository
in interfaceMetaDataContext
-
getType
Description copied from interface:ValueMetaData
The value class.- Specified by:
getType
in interfaceValueMetaData
-
setType
Description copied from interface:ValueMetaData
The value class.- Specified by:
setType
in interfaceValueMetaData
-
getTypeCode
public int getTypeCode()Description copied from interface:ValueMetaData
The type code of the value class.- Specified by:
getTypeCode
in interfaceValueMetaData
-
setTypeCode
public void setTypeCode(int code) Description copied from interface:ValueMetaData
The type code of the value class.- Specified by:
setTypeCode
in interfaceValueMetaData
-
isTypePC
public boolean isTypePC()Description copied from interface:ValueMetaData
Whether the type is a persistence capable instance.- Specified by:
isTypePC
in interfaceValueMetaData
-
getTypeMetaData
Description copied from interface:ValueMetaData
The metadata for the value class, if the type is persistent.- Specified by:
getTypeMetaData
in interfaceValueMetaData
-
getDeclaredType
Description copied from interface:ValueMetaData
Return the declared class of the value. This can differ from the return value ofValueMetaData.getType()
if the user indicates a different type or the value has an externalizer.- Specified by:
getDeclaredType
in interfaceValueMetaData
-
setDeclaredType
Description copied from interface:ValueMetaData
Set the declared class of the value.- Specified by:
setDeclaredType
in interfaceValueMetaData
-
getDeclaredTypeCode
public int getDeclaredTypeCode()Description copied from interface:ValueMetaData
Return the declared type code of the value. This can differ from the return value ofValueMetaData.getTypeCode()
if the user indicates a different type or the value has an externalizer.- Specified by:
getDeclaredTypeCode
in interfaceValueMetaData
-
setDeclaredTypeCode
public void setDeclaredTypeCode(int code) Description copied from interface:ValueMetaData
Set the type code for the value. The type code is usually computed automatically, but it can be useful to set it explicitly when creating metadatas from scratch.- Specified by:
setDeclaredTypeCode
in interfaceValueMetaData
-
isDeclaredTypePC
public boolean isDeclaredTypePC()Description copied from interface:ValueMetaData
Whether the type is a persistence capable instance.- Specified by:
isDeclaredTypePC
in interfaceValueMetaData
-
getDeclaredTypeMetaData
Description copied from interface:ValueMetaData
Return metadata for the value's class, if the type is persistent.- Specified by:
getDeclaredTypeMetaData
in interfaceValueMetaData
-
isEmbedded
public boolean isEmbedded()Description copied from interface:ValueMetaData
This attribute is a hint to the implementation to store this value in the same structure as the class, rather than as a separate datastore structure. Defaults to true if the field is not a collection or map or persistence-capable object; defaults to false otherwise. Implementations are permitted to ignore this attribute.- Specified by:
isEmbedded
in interfaceValueMetaData
-
setEmbedded
public void setEmbedded(boolean embedded) Description copied from interface:ValueMetaData
This attribute is a hint to the implementation to store this value in the same structure as the class, rather than as a separate datastore structure. Defaults to true if the field is not a collection or map or persistence-capable objects; defaults to false otherwise. Implementations are permitted to ignore this attribute.- Specified by:
setEmbedded
in interfaceValueMetaData
-
isEmbeddedPC
public boolean isEmbeddedPC()Description copied from interface:ValueMetaData
Whether this is an embedded persistence capable value.- Specified by:
isEmbeddedPC
in interfaceValueMetaData
-
getEmbeddedMetaData
Description copied from interface:ValueMetaData
The embedded class metadata for the value.- Specified by:
getEmbeddedMetaData
in interfaceValueMetaData
-
addEmbeddedMetaData
Description copied from interface:ValueMetaData
Add embedded metadata for this value with the given access type- Specified by:
addEmbeddedMetaData
in interfaceValueMetaData
-
addEmbeddedMetaData
Description copied from interface:ValueMetaData
Add embedded metadata for this value.- Specified by:
addEmbeddedMetaData
in interfaceValueMetaData
-
getCascadeDelete
public int getCascadeDelete()Description copied from interface:ValueMetaData
Cascade behavior for delete operation. Only applies to persistence-capable values. Options are:
CASCADE_NONE
: No cascades.CASCADE_IMMEDIATE
: Value is deleted immediately when the owning object is deleted.CASCADE_AUTO
: Value will be deleted on flush if the owning object is deleted or if the value is removed from the owning object, and if the value is not assigned to another relation in the same transaction.
- Specified by:
getCascadeDelete
in interfaceValueMetaData
-
setCascadeDelete
public void setCascadeDelete(int delete) Description copied from interface:ValueMetaData
Cascade behavior for deletion.- Specified by:
setCascadeDelete
in interfaceValueMetaData
- See Also:
-
getCascadePersist
public int getCascadePersist()Description copied from interface:ValueMetaData
Cascade behavior for persist operation. Only applies to persistence-capable values. Options are:
CASCADE_NONE
: No cascades. If a transient relation is held at flush, an error is thrown.CASCADE_IMMEDIATE
: Value is persisted immediately when the owning object is persisted.CASCADE_AUTO
: Value will be persisted on flush.
- Specified by:
getCascadePersist
in interfaceValueMetaData
-
setCascadePersist
public void setCascadePersist(int persist) Description copied from interface:ValueMetaData
Cascade behavior for persist operation.- Specified by:
setCascadePersist
in interfaceValueMetaData
- See Also:
-
setCascadePersist
public void setCascadePersist(int persist, boolean checkPUDefault) Description copied from interface:ValueMetaData
Cascade behavior for persist operation.- Specified by:
setCascadePersist
in interfaceValueMetaData
- See Also:
-
getCascadeAttach
public int getCascadeAttach()Description copied from interface:ValueMetaData
Cascade behavior for attach operation. Only applies to persistence-capable values. Options are:
CASCADE_NONE
: No cascades of attach. Relation remains detached.CASCADE_IMMEDIATE
: Value is attached immediately.
- Specified by:
getCascadeAttach
in interfaceValueMetaData
-
setCascadeAttach
public void setCascadeAttach(int attach) Description copied from interface:ValueMetaData
Cascade behavior for attach operation.- Specified by:
setCascadeAttach
in interfaceValueMetaData
- See Also:
-
getCascadeDetach
public int getCascadeDetach()Description copied from interface:ValueMetaData
Cascade behavior for detach operation. Only applies to persistence-capable values. Options are:
CASCADE_NONE
: No cascades of detach. Relation remains attached.CASCADE_IMMEDIATE
: Value is detached immediately.
- Specified by:
getCascadeDetach
in interfaceValueMetaData
-
setCascadeDetach
public void setCascadeDetach(int detach) Description copied from interface:ValueMetaData
Cascade behavior for detach operation.- Specified by:
setCascadeDetach
in interfaceValueMetaData
- See Also:
-
getCascadeRefresh
public int getCascadeRefresh()Description copied from interface:ValueMetaData
Cascade behavior for refresh operation. Only applies to persistence-capable values. Options are:
CASCADE_NONE
: No cascades of refresh.CASCADE_IMMEDIATE
: Persistent value object is also refreshed.CASCADE_AUTO
: Value will be refreshed if it is in the current fetch groups.
- Specified by:
getCascadeRefresh
in interfaceValueMetaData
-
setCascadeRefresh
public void setCascadeRefresh(int refresh) Description copied from interface:ValueMetaData
Cascade behavior for refresh operation.- Specified by:
setCascadeRefresh
in interfaceValueMetaData
- See Also:
-
isSerialized
public boolean isSerialized()Description copied from interface:ValueMetaData
Whether this value is serialized when stored.- Specified by:
isSerialized
in interfaceValueMetaData
-
setSerialized
public void setSerialized(boolean serialized) Description copied from interface:ValueMetaData
Whether this value is serialized when stored.- Specified by:
setSerialized
in interfaceValueMetaData
-
getValueMappedBy
Description copied from interface:ValueMetaData
The field that this value shares a mapping with. Currently the only supported use for a mapped-by value is when a map field key is determined by a field of the persistence-capable map value.- Specified by:
getValueMappedBy
in interfaceValueMetaData
-
setValueMappedBy
Description copied from interface:ValueMetaData
The field that this value shares a mapping with. Currently the only supported use for a mapped-by value is when a map field key is determined by a field of the persistence-capable map value.- Specified by:
setValueMappedBy
in interfaceValueMetaData
-
getValueMappedByMetaData
Description copied from interface:ValueMetaData
The field that this value shares a mapping with. Currently the only supported use for a mapped-by value is when a map field key is determined by a field of the persistence-capable map value.- Specified by:
getValueMappedByMetaData
in interfaceValueMetaData
-
getTypeOverride
Description copied from interface:ValueMetaData
User-supplied type overriding assumed type based on field.- Specified by:
getTypeOverride
in interfaceValueMetaData
-
setTypeOverride
Description copied from interface:ValueMetaData
User-supplied type overriding assumed type based on field.- Specified by:
setTypeOverride
in interfaceValueMetaData
-
toString
-
getResolve
public int getResolve()Description copied from interface:ValueMetaData
Resolve mode for metadata.- Specified by:
getResolve
in interfaceValueMetaData
-
setResolve
public void setResolve(int mode) Description copied from interface:ValueMetaData
Resolve mode for metadata.- Specified by:
setResolve
in interfaceValueMetaData
-
setResolve
public void setResolve(int mode, boolean on) Description copied from interface:ValueMetaData
Resolve mode for metadata.- Specified by:
setResolve
in interfaceValueMetaData
-
resolve
public boolean resolve(int mode) Description copied from interface:ValueMetaData
Resolve and validate metadata. Return true if already resolved.- Specified by:
resolve
in interfaceValueMetaData
-
copy
Description copied from interface:ValueMetaData
Copy state from the given value to this one. Do not copy mapping information.- Specified by:
copy
in interfaceValueMetaData
-