Package org.apache.openjpa.jdbc.meta
Class ValueMappingImpl
- java.lang.Object
-
- org.apache.openjpa.meta.ValueMetaDataImpl
-
- org.apache.openjpa.jdbc.meta.ValueMappingImpl
-
- All Implemented Interfaces:
java.io.Serializable,ValueMapping,MetaDataContext,MetaDataModes,ValueMetaData
public class ValueMappingImpl extends ValueMetaDataImpl implements ValueMapping
StandaloneValueMappingimplementation.- Since:
- 0.4.0
- 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.jdbc.meta.ValueMapping
JOIN_EXPECTED_INVERSE, JOIN_FORWARD, JOIN_INVERSE, POLY_FALSE, POLY_JOINABLE, POLY_TRUE
-
Fields inherited from interface org.apache.openjpa.meta.ValueMetaData
CASCADE_AUTO, CASCADE_IMMEDIATE, CASCADE_NONE, MAPPED_BY_PK
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedValueMappingImpl()Constructor for deserialization.ValueMappingImpl(FieldMapping owner)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidclearMapping()Clear mapping information, including strategy.voidcopy(ValueMetaData vmd)Copy state from the given value to this one.voidcopyMappingInfo(ValueMapping vm)Copy mapping info from the given instance to this one.ColumnIOgetColumnIO()I/O information on the foreign key, or columns if this value doesn't have a key.Column[]getColumns()The columns that hold the data for this value.ClassMappinggetDeclaredTypeMapping()Convenience method to perform cast fromValueMetaData.getDeclaredTypeMetaData().ClassMappinggetEmbeddedMapping()Convenience method to perform cast fromValueMetaData.getEmbeddedMetaData().FieldMappinggetFieldMapping()Convenience method to perform cast fromValueMetaData.getFieldMetaData().ForeignKeygetForeignKey()If this value joins to another record, the foreign key.ForeignKeygetForeignKey(ClassMapping target)Return an equivalent of this value's foreign key, but joining to the given target, which may be an unjoined subclass of this value's related type.ForeignKeygetForeignKey(ClassMapping target, int targetNumber)ValueHandlergetHandler()The handler used for this value, or null if none.ClassMapping[]getIndependentTypeMappings()Return all independently-mapped joinable types for this value, depending on whether this value is polymorphic and how the related type is mapped.intgetJoinDirection()The join direction.MappingRepositorygetMappingRepository()Convenience method to perform cast fromMetaDataContext.getRepository().intgetPolymorphic()The degree to which this relation is polymorphic.intgetSelectSubclasses()Return theorg.apache.openjpa.sql.Selectsubclasses constant for loading this relation, based on how the related type is mapped, whether this relation is polymorphic, and whether it is configured to use class criteria.ClassMappinggetTypeMapping()Convenience method to perform cast fromValueMetaData.getTypeMetaData().booleangetUseClassCriteria()Whether to use class criteria when joining to related type.IndexgetValueIndex()Index on this value's columns, or null if none.ValueMappingInfogetValueInfo()Raw mapping data.FieldMappinggetValueMappedByMapping()Convenience method to perform cast fromValueMetaData.getValueMappedByMetaData().UniquegetValueUnique()Unique constraint on this value's columns, or null if none.voidmapConstraints(java.lang.String name, boolean adapt)Deprecated.voidmapConstraints(DBIdentifier name, boolean adapt)Map indexes and constraints for this value, using the currentValueMappingInfo.voidrefSchemaComponents()Increase the reference count on used schema components.booleanresolve(int mode)Resolve and validate metadata.voidsetColumnIO(ColumnIO io)I/O information on the foreign key, or columns if this value doesn't have a key.voidsetColumns(Column[] cols)The columns that hold the data for this value.voidsetForeignKey(ForeignKey fk)If this value joins to another record, the foreign key.voidsetForeignKey(Row row, OpenJPAStateManager rel)Sets this value's foreign key to the given related object.voidsetForeignKey(Row row, OpenJPAStateManager rel, int targetNumber)Sets this value's foreign key to the given related object.voidsetHandler(ValueHandler handler)The handler used for this value, or null if none.voidsetJoinDirection(int direction)The join direction.voidsetPolymorphic(int poly)The degree to which this relation is polymorphic.voidsetUseClassCriteria(boolean criteria)Whether to use class criteria when joining to related type.voidsetValueIndex(Index idx)Index on this value's columns, or null if none.voidsetValueUnique(Unique unq)Unique constraint on this value's columns, or null if none.voidsyncMappingInfo()UpdateMappingInfowith our current mapping information.voidwhereForeignKey(Row row, OpenJPAStateManager rel)Sets this value's foreign key to the given related object.-
Methods inherited from class org.apache.openjpa.meta.ValueMetaDataImpl
addEmbeddedMetaData, addEmbeddedMetaData, getCascadeAttach, getCascadeDelete, getCascadeDetach, getCascadePersist, getCascadeRefresh, getDeclaredType, getDeclaredTypeCode, getDeclaredTypeMetaData, getEmbeddedMetaData, getFieldMetaData, getRepository, getResolve, getType, getTypeCode, getTypeMetaData, getTypeOverride, getValueMappedBy, getValueMappedByMetaData, isDeclaredTypePC, isEmbedded, isEmbeddedPC, isSerialized, isTypePC, setCascadeAttach, setCascadeDelete, setCascadeDetach, setCascadePersist, setCascadePersist, setCascadeRefresh, setDeclaredType, setDeclaredTypeCode, setEmbedded, setResolve, setResolve, setSerialized, setType, setTypeCode, setTypeOverride, setValueMappedBy, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.openjpa.meta.MetaDataContext
getRepository
-
Methods inherited from interface org.apache.openjpa.meta.ValueMetaData
addEmbeddedMetaData, addEmbeddedMetaData, getCascadeAttach, getCascadeDelete, getCascadeDetach, getCascadePersist, getCascadeRefresh, getDeclaredType, getDeclaredTypeCode, getDeclaredTypeMetaData, getEmbeddedMetaData, getFieldMetaData, getResolve, getType, getTypeCode, getTypeMetaData, getTypeOverride, getValueMappedBy, getValueMappedByMetaData, isDeclaredTypePC, isEmbedded, isEmbeddedPC, isSerialized, isTypePC, setCascadeAttach, setCascadeDelete, setCascadeDetach, setCascadePersist, setCascadePersist, setCascadeRefresh, setDeclaredType, setDeclaredTypeCode, setEmbedded, setResolve, setResolve, setSerialized, setType, setTypeCode, setTypeOverride, setValueMappedBy
-
-
-
-
Constructor Detail
-
ValueMappingImpl
public ValueMappingImpl(FieldMapping owner)
Constructor. Supply owning mapping.
-
ValueMappingImpl
protected ValueMappingImpl()
Constructor for deserialization.
-
-
Method Detail
-
getValueInfo
public ValueMappingInfo getValueInfo()
Description copied from interface:ValueMappingRaw mapping data.- Specified by:
getValueInfoin interfaceValueMapping
-
getHandler
public ValueHandler getHandler()
Description copied from interface:ValueMappingThe handler used for this value, or null if none.- Specified by:
getHandlerin interfaceValueMapping
-
setHandler
public void setHandler(ValueHandler handler)
Description copied from interface:ValueMappingThe handler used for this value, or null if none.- Specified by:
setHandlerin interfaceValueMapping
-
getMappingRepository
public MappingRepository getMappingRepository()
Description copied from interface:ValueMappingConvenience method to perform cast fromMetaDataContext.getRepository().- Specified by:
getMappingRepositoryin interfaceValueMapping
-
getFieldMapping
public FieldMapping getFieldMapping()
Description copied from interface:ValueMappingConvenience method to perform cast fromValueMetaData.getFieldMetaData().- Specified by:
getFieldMappingin interfaceValueMapping
-
getTypeMapping
public ClassMapping getTypeMapping()
Description copied from interface:ValueMappingConvenience method to perform cast fromValueMetaData.getTypeMetaData().- Specified by:
getTypeMappingin interfaceValueMapping
-
getDeclaredTypeMapping
public ClassMapping getDeclaredTypeMapping()
Description copied from interface:ValueMappingConvenience method to perform cast fromValueMetaData.getDeclaredTypeMetaData().- Specified by:
getDeclaredTypeMappingin interfaceValueMapping
-
getEmbeddedMapping
public ClassMapping getEmbeddedMapping()
Description copied from interface:ValueMappingConvenience method to perform cast fromValueMetaData.getEmbeddedMetaData().- Specified by:
getEmbeddedMappingin interfaceValueMapping
-
getValueMappedByMapping
public FieldMapping getValueMappedByMapping()
Description copied from interface:ValueMappingConvenience method to perform cast fromValueMetaData.getValueMappedByMetaData().- Specified by:
getValueMappedByMappingin interfaceValueMapping
-
getColumns
public Column[] getColumns()
Description copied from interface:ValueMappingThe columns that hold the data for this value.- Specified by:
getColumnsin interfaceValueMapping
-
setColumns
public void setColumns(Column[] cols)
Description copied from interface:ValueMappingThe columns that hold the data for this value.- Specified by:
setColumnsin interfaceValueMapping
-
getColumnIO
public ColumnIO getColumnIO()
Description copied from interface:ValueMappingI/O information on the foreign key, or columns if this value doesn't have a key.- Specified by:
getColumnIOin interfaceValueMapping
-
setColumnIO
public void setColumnIO(ColumnIO io)
Description copied from interface:ValueMappingI/O information on the foreign key, or columns if this value doesn't have a key.- Specified by:
setColumnIOin interfaceValueMapping
-
getForeignKey
public ForeignKey getForeignKey()
Description copied from interface:ValueMappingIf this value joins to another record, the foreign key.- Specified by:
getForeignKeyin interfaceValueMapping
-
setForeignKey
public void setForeignKey(ForeignKey fk)
Description copied from interface:ValueMappingIf this value joins to another record, the foreign key.- Specified by:
setForeignKeyin interfaceValueMapping
-
getForeignKey
public ForeignKey getForeignKey(ClassMapping target, int targetNumber)
-
getForeignKey
public ForeignKey getForeignKey(ClassMapping target)
Description copied from interface:ValueMappingReturn an equivalent of this value's foreign key, but joining to the given target, which may be an unjoined subclass of this value's related type.- Specified by:
getForeignKeyin interfaceValueMapping
-
getJoinDirection
public int getJoinDirection()
Description copied from interface:ValueMappingThe join direction.- Specified by:
getJoinDirectionin interfaceValueMapping
-
setJoinDirection
public void setJoinDirection(int direction)
Description copied from interface:ValueMappingThe join direction.- Specified by:
setJoinDirectionin interfaceValueMapping
-
setForeignKey
public void setForeignKey(Row row, OpenJPAStateManager rel, int targetNumber) throws java.sql.SQLException
Description copied from interface:ValueMappingSets this value's foreign key to the given related object. The object may be null. If the object is one of2or more foreign keys with the same target, the targetNumber specifies the one to set.- Specified by:
setForeignKeyin interfaceValueMapping- Throws:
java.sql.SQLException
-
setForeignKey
public void setForeignKey(Row row, OpenJPAStateManager rel) throws java.sql.SQLException
Description copied from interface:ValueMappingSets this value's foreign key to the given related object. The object may be null.- Specified by:
setForeignKeyin interfaceValueMapping- Throws:
java.sql.SQLException
-
whereForeignKey
public void whereForeignKey(Row row, OpenJPAStateManager rel) throws java.sql.SQLException
Description copied from interface:ValueMappingSets this value's foreign key to the given related object. The object may be null.- Specified by:
whereForeignKeyin interfaceValueMapping- Throws:
java.sql.SQLException
-
getIndependentTypeMappings
public ClassMapping[] getIndependentTypeMappings()
Description copied from interface:ValueMappingReturn all independently-mapped joinable types for this value, depending on whether this value is polymorphic and how the related type is mapped. Return an empty array if value type is not PC.- Specified by:
getIndependentTypeMappingsin interfaceValueMapping
-
getSelectSubclasses
public int getSelectSubclasses()
Description copied from interface:ValueMappingReturn theorg.apache.openjpa.sql.Selectsubclasses constant for loading this relation, based on how the related type is mapped, whether this relation is polymorphic, and whether it is configured to use class criteria.- Specified by:
getSelectSubclassesin interfaceValueMapping
-
getValueUnique
public Unique getValueUnique()
Description copied from interface:ValueMappingUnique constraint on this value's columns, or null if none.- Specified by:
getValueUniquein interfaceValueMapping
-
setValueUnique
public void setValueUnique(Unique unq)
Description copied from interface:ValueMappingUnique constraint on this value's columns, or null if none.- Specified by:
setValueUniquein interfaceValueMapping
-
getValueIndex
public Index getValueIndex()
Description copied from interface:ValueMappingIndex on this value's columns, or null if none.- Specified by:
getValueIndexin interfaceValueMapping
-
setValueIndex
public void setValueIndex(Index idx)
Description copied from interface:ValueMappingIndex on this value's columns, or null if none.- Specified by:
setValueIndexin interfaceValueMapping
-
getUseClassCriteria
public boolean getUseClassCriteria()
Description copied from interface:ValueMappingWhether to use class criteria when joining to related type.- Specified by:
getUseClassCriteriain interfaceValueMapping
-
setUseClassCriteria
public void setUseClassCriteria(boolean criteria)
Description copied from interface:ValueMappingWhether to use class criteria when joining to related type.- Specified by:
setUseClassCriteriain interfaceValueMapping
-
getPolymorphic
public int getPolymorphic()
Description copied from interface:ValueMappingThe degree to which this relation is polymorphic.- Specified by:
getPolymorphicin interfaceValueMapping
-
setPolymorphic
public void setPolymorphic(int poly)
Description copied from interface:ValueMappingThe degree to which this relation is polymorphic.- Specified by:
setPolymorphicin interfaceValueMapping
-
refSchemaComponents
public void refSchemaComponents()
Description copied from interface:ValueMappingIncrease the reference count on used schema components.- Specified by:
refSchemaComponentsin interfaceValueMapping
-
mapConstraints
@Deprecated public void mapConstraints(java.lang.String name, boolean adapt)Deprecated.Description copied from interface:ValueMappingMap indexes and constraints for this value, using the currentValueMappingInfo. The foreign key or columns of this value must be set before calling this method.- Specified by:
mapConstraintsin interfaceValueMapping
-
mapConstraints
public void mapConstraints(DBIdentifier name, boolean adapt)
Description copied from interface:ValueMappingMap indexes and constraints for this value, using the currentValueMappingInfo. The foreign key or columns of this value must be set before calling this method.- Specified by:
mapConstraintsin interfaceValueMapping
-
clearMapping
public void clearMapping()
Description copied from interface:ValueMappingClear mapping information, including strategy.- Specified by:
clearMappingin interfaceValueMapping
-
syncMappingInfo
public void syncMappingInfo()
Description copied from interface:ValueMappingUpdateMappingInfowith our current mapping information.- Specified by:
syncMappingInfoin interfaceValueMapping
-
copy
public void copy(ValueMetaData vmd)
Description copied from interface:ValueMetaDataCopy state from the given value to this one. Do not copy mapping information.- Specified by:
copyin interfaceValueMetaData- Overrides:
copyin classValueMetaDataImpl
-
copyMappingInfo
public void copyMappingInfo(ValueMapping vm)
Description copied from interface:ValueMappingCopy mapping info from the given instance to this one.- Specified by:
copyMappingInfoin interfaceValueMapping
-
resolve
public boolean resolve(int mode)
Description copied from interface:ValueMetaDataResolve and validate metadata. Return true if already resolved.- Specified by:
resolvein interfaceValueMetaData- Overrides:
resolvein classValueMetaDataImpl
-
-