Package org.apache.openjpa.meta
Interface ValueMetaData
- All Superinterfaces:
MetaDataContext
,MetaDataModes
,Serializable
- All Known Subinterfaces:
ValueMapping
- All Known Implementing Classes:
FieldMapping
,FieldMetaData
,ValueMappingImpl
,ValueMetaDataImpl
Holds metadata on a value; this could be a field value, key value, or
element value.
- Since:
- 0.4.0
- Author:
- Abe White
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
Use automatic cascade behavior.static final int
The operation is immediately cascaded to this field.static final int
The operation is not cascaded to this field.static final String
Marker to set onsetValueMappedBy(java.lang.String)
to denote that the map key is mapped by the primary key field of the value.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
-
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.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 cascade) Cascade behavior for attach operation.void
setCascadeDelete
(int cascade) Cascade behavior for deletion.void
setCascadeDetach
(int cascade) Cascade behavior for detach operation.void
setCascadePersist
(int cascade) Cascade behavior for persist operation.void
setCascadePersist
(int cascade, boolean checkPUDefault) Cascade behavior for persist operation.void
setCascadeRefresh
(int cascade) Cascade behavior for refresh operation.void
setDeclaredType
(Class type) Set the declared class of the value.void
setDeclaredTypeCode
(int type) 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 type) User-supplied type overriding assumed type based on field.void
setValueMappedBy
(String mapped) The field that this value shares a mapping with.Methods inherited from interface org.apache.openjpa.meta.MetaDataContext
getRepository
-
Field Details
-
CASCADE_NONE
static final int CASCADE_NONEThe operation is not cascaded to this field.- See Also:
-
CASCADE_IMMEDIATE
static final int CASCADE_IMMEDIATEThe operation is immediately cascaded to this field.- See Also:
-
CASCADE_AUTO
static final int CASCADE_AUTOUse automatic cascade behavior. Persistence-by-reachability, delete-dependent, attach-if-detached, etc.- See Also:
-
MAPPED_BY_PK
Marker to set onsetValueMappedBy(java.lang.String)
to denote that the map key is mapped by the primary key field of the value.- See Also:
-
-
Method Details
-
getFieldMetaData
FieldMetaData getFieldMetaData()Return the owning field for this value. -
getType
Class getType()The value class. -
setType
The value class. -
getTypeCode
int getTypeCode()The type code of the value class. -
setTypeCode
void setTypeCode(int code) The type code of the value class. -
isTypePC
boolean isTypePC()Whether the type is a persistence capable instance. -
getTypeMetaData
ClassMetaData getTypeMetaData()The metadata for the value class, if the type is persistent. -
getDeclaredType
Class getDeclaredType()Return the declared class of the value. This can differ from the return value ofgetType()
if the user indicates a different type or the value has an externalizer. -
setDeclaredType
Set the declared class of the value. -
getDeclaredTypeCode
int getDeclaredTypeCode()Return the declared type code of the value. This can differ from the return value ofgetTypeCode()
if the user indicates a different type or the value has an externalizer. -
setDeclaredTypeCode
void setDeclaredTypeCode(int type) 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. -
isDeclaredTypePC
boolean isDeclaredTypePC()Whether the type is a persistence capable instance. -
getDeclaredTypeMetaData
ClassMetaData getDeclaredTypeMetaData()Return metadata for the value's class, if the type is persistent. -
isEmbedded
boolean isEmbedded()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. -
setEmbedded
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. 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. -
isEmbeddedPC
boolean isEmbeddedPC()Whether this is an embedded persistence capable value. -
getEmbeddedMetaData
ClassMetaData getEmbeddedMetaData()The embedded class metadata for the value. -
addEmbeddedMetaData
ClassMetaData addEmbeddedMetaData()Add embedded metadata for this value. -
addEmbeddedMetaData
Add embedded metadata for this value with the given access type -
getCascadeDelete
int getCascadeDelete()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.
-
setCascadeDelete
void setCascadeDelete(int cascade) Cascade behavior for deletion.- See Also:
-
getCascadePersist
int getCascadePersist()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.
-
setCascadePersist
void setCascadePersist(int cascade) Cascade behavior for persist operation.- See Also:
-
setCascadePersist
void setCascadePersist(int cascade, boolean checkPUDefault) Cascade behavior for persist operation.- See Also:
-
getCascadeAttach
int getCascadeAttach()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.
-
setCascadeAttach
void setCascadeAttach(int cascade) Cascade behavior for attach operation.- See Also:
-
getCascadeDetach
int getCascadeDetach()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.
-
setCascadeDetach
void setCascadeDetach(int cascade) Cascade behavior for detach operation.- See Also:
-
getCascadeRefresh
int getCascadeRefresh()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.
-
setCascadeRefresh
void setCascadeRefresh(int cascade) Cascade behavior for refresh operation.- See Also:
-
isSerialized
boolean isSerialized()Whether this value is serialized when stored. -
setSerialized
void setSerialized(boolean serialized) Whether this value is serialized when stored. -
getValueMappedBy
String getValueMappedBy()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. -
setValueMappedBy
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. -
getValueMappedByMetaData
FieldMetaData getValueMappedByMetaData()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. -
getTypeOverride
Class getTypeOverride()User-supplied type overriding assumed type based on field. -
setTypeOverride
User-supplied type overriding assumed type based on field. -
getResolve
int getResolve()Resolve mode for metadata. -
setResolve
void setResolve(int mode) Resolve mode for metadata. -
setResolve
void setResolve(int mode, boolean on) Resolve mode for metadata. -
resolve
boolean resolve(int mode) Resolve and validate metadata. Return true if already resolved. -
copy
Copy state from the given value to this one. Do not copy mapping information.
-