Package org.apache.openjpa.meta
Class ValueMetaDataImpl
- java.lang.Object
-
- org.apache.openjpa.meta.ValueMetaDataImpl
-
- All Implemented Interfaces:
java.io.Serializable
,MetaDataContext
,MetaDataModes
,ValueMetaData
- Direct Known Subclasses:
ValueMappingImpl
public class ValueMetaDataImpl extends java.lang.Object implements ValueMetaData
DefaultValueMetaData
implementation.- Author:
- Abe White
- See Also:
- Serialized Form
-
-
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
Constructors Modifier Constructor Description protected
ValueMetaDataImpl()
Constructor for serialization.protected
ValueMetaDataImpl(FieldMetaData owner)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ClassMetaData
addEmbeddedMetaData()
Add embedded metadata for this value.ClassMetaData
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
getCascadeAttach()
Cascade behavior for attach operation.int
getCascadeDelete()
Cascade behavior for delete operation.int
getCascadeDetach()
Cascade behavior for detach operation.int
getCascadePersist()
Cascade behavior for persist operation.int
getCascadeRefresh()
Cascade behavior for refresh operation.java.lang.Class
getDeclaredType()
Return the declared class of the value.int
getDeclaredTypeCode()
Return the declared type code of the value.ClassMetaData
getDeclaredTypeMetaData()
Return metadata for the value's class, if the type is persistent.ClassMetaData
getEmbeddedMetaData()
The embedded class metadata for the value.FieldMetaData
getFieldMetaData()
Return the owning field for this value.MetaDataRepository
getRepository()
Access metadata repository.int
getResolve()
Resolve mode for metadata.java.lang.Class
getType()
The value class.int
getTypeCode()
The type code of the value class.ClassMetaData
getTypeMetaData()
The metadata for the value class, if the type is persistent.java.lang.Class
getTypeOverride()
User-supplied type overriding assumed type based on field.java.lang.String
getValueMappedBy()
The field that this value shares a mapping with.FieldMetaData
getValueMappedByMetaData()
The field that this value shares a mapping with.boolean
isDeclaredTypePC()
Whether the type is a persistence capable instance.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.boolean
isEmbeddedPC()
Whether this is an embedded persistence capable value.boolean
isSerialized()
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(java.lang.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
setType(java.lang.Class type)
The value class.void
setTypeCode(int code)
The type code of the value class.void
setTypeOverride(java.lang.Class val)
User-supplied type overriding assumed type based on field.void
setValueMappedBy(java.lang.String mapped)
The field that this value shares a mapping with.java.lang.String
toString()
-
-
-
Constructor Detail
-
ValueMetaDataImpl
protected ValueMetaDataImpl(FieldMetaData owner)
-
ValueMetaDataImpl
protected ValueMetaDataImpl()
Constructor for serialization.
-
-
Method Detail
-
getFieldMetaData
public FieldMetaData getFieldMetaData()
Description copied from interface:ValueMetaData
Return the owning field for this value.- Specified by:
getFieldMetaData
in interfaceValueMetaData
-
getRepository
public MetaDataRepository getRepository()
Description copied from interface:MetaDataContext
Access metadata repository.- Specified by:
getRepository
in interfaceMetaDataContext
-
getType
public java.lang.Class getType()
Description copied from interface:ValueMetaData
The value class.- Specified by:
getType
in interfaceValueMetaData
-
setType
public void setType(java.lang.Class type)
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
public ClassMetaData getTypeMetaData()
Description copied from interface:ValueMetaData
The metadata for the value class, if the type is persistent.- Specified by:
getTypeMetaData
in interfaceValueMetaData
-
getDeclaredType
public java.lang.Class 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
public void setDeclaredType(java.lang.Class type)
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
public ClassMetaData 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
public ClassMetaData getEmbeddedMetaData()
Description copied from interface:ValueMetaData
The embedded class metadata for the value.- Specified by:
getEmbeddedMetaData
in interfaceValueMetaData
-
addEmbeddedMetaData
public ClassMetaData addEmbeddedMetaData(int access)
Description copied from interface:ValueMetaData
Add embedded metadata for this value with the given access type- Specified by:
addEmbeddedMetaData
in interfaceValueMetaData
-
addEmbeddedMetaData
public ClassMetaData 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:
ValueMetaData.getCascadeDelete()
-
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:
ValueMetaData.getCascadePersist()
-
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:
ValueMetaData.getCascadePersist()
-
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:
ValueMetaData.getCascadeAttach()
-
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:
ValueMetaData.getCascadeDetach()
-
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:
ValueMetaData.getCascadeRefresh()
-
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
public java.lang.String 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
public void setValueMappedBy(java.lang.String mapped)
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
public FieldMetaData 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
public java.lang.Class getTypeOverride()
Description copied from interface:ValueMetaData
User-supplied type overriding assumed type based on field.- Specified by:
getTypeOverride
in interfaceValueMetaData
-
setTypeOverride
public void setTypeOverride(java.lang.Class val)
Description copied from interface:ValueMetaData
User-supplied type overriding assumed type based on field.- Specified by:
setTypeOverride
in interfaceValueMetaData
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
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
public void copy(ValueMetaData vmd)
Description copied from interface:ValueMetaData
Copy state from the given value to this one. Do not copy mapping information.- Specified by:
copy
in interfaceValueMetaData
-
-