Class ObjectAccessor
- java.lang.Object
-
- org.eclipse.persistence.internal.jpa.metadata.ORMetadata
-
- org.eclipse.persistence.internal.jpa.metadata.accessors.MetadataAccessor
-
- org.eclipse.persistence.internal.jpa.metadata.accessors.mappings.MappingAccessor
-
- org.eclipse.persistence.internal.jpa.metadata.accessors.mappings.RelationshipAccessor
-
- org.eclipse.persistence.internal.jpa.metadata.accessors.mappings.ObjectAccessor
-
- Direct Known Subclasses:
ManyToOneAccessor
,OneToOneAccessor
,VariableOneToOneAccessor
public abstract class ObjectAccessor extends RelationshipAccessor
INTERNAL: A single object relationship accessor. Key notes: - any metadata mapped from XML to this class must be compared in the equals method. - any metadata mapped from XML to this class must be handled in the merge method. (merging is done at the accessor/mapping level) - any metadata mapped from XML to this class must be initialized in the initXMLObject method. - methods should be preserved in alphabetical order.- Since:
- TopLink EJB 3.0 Reference Implementation
- Author:
- Guy Pelletier
-
-
Field Summary
-
Fields inherited from class org.eclipse.persistence.internal.jpa.metadata.accessors.mappings.RelationshipAccessor
m_referenceClass
-
Fields inherited from class org.eclipse.persistence.internal.jpa.metadata.accessors.mappings.MappingAccessor
KEY_DOT_NOTATION, m_field, VALUE_DOT_NOTATION
-
Fields inherited from class org.eclipse.persistence.internal.jpa.metadata.ORMetadata
m_project
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
ObjectAccessor(String xmlElement)
INTERNAL: Used for OX mapping.protected
ObjectAccessor(MetadataAnnotation annotation, MetadataAnnotatedElement annotatedElement, ClassAccessor classAccessor)
INTERNAL:
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
derivesId()
INTERNAL: Return true is this accessor is a derived id accessor.boolean
equals(Object objectToCompare)
INTERNAL:String
getAttributeType()
INTERNAL: The attribute type for virtual object accessors is the target entity.String
getDefaultFetchType()
INTERNAL: Return the default fetch type for an object mapping.Boolean
getId()
INTERNAL:String
getMapsId()
INTERNAL: Used for OX mapping.Boolean
getOptional()
INTERNAL: Used for OX mapping.PrimaryKeyForeignKeyMetadata
getPrimaryKeyForeignKey()
INTERNAL: Used for OX mapping.List<PrimaryKeyJoinColumnMetadata>
getPrimaryKeyJoinColumns()
INTERNAL: Used for OX mapping.MetadataClass
getReferenceClass()
INTERNAL: If a target entity is specified in metadata, it will be set as the reference class, otherwise we will use the raw class.protected MetadataClass
getSimplePKType()
INTERNAL: Used to process primary keys and DerivedIds.boolean
hasAttributeType()
INTERNAL: Object accessors don't require a separate attribute-type specification in XML, instead they can use the reference class to determine the attribute-type.int
hashCode()
protected boolean
hasId()
INTERNAL:protected boolean
hasMapsId()
INTERNAL:protected ObjectReferenceMapping
initManyToOneMapping()
INTERNAL: Initialize a ManyToOneMapping.protected ObjectReferenceMapping
initOneToOneMapping()
INTERNAL: Initialize a OneToOneMapping.void
initXMLObject(MetadataAccessibleObject accessibleObject, XMLEntityMappings entityMappings)
INTERNAL:boolean
isOneToOnePrimaryKeyRelationship()
INTERNAL: Return true if this accessor represents a 1-1 primary key relationship.boolean
isOptional()
INTERNAL:protected void
processAssociationOverride(AssociationOverrideMetadata associationOverride, EmbeddableMapping embeddableMapping, DatabaseTable defaultTable, MetadataDescriptor owningDescriptor)
INTERNAL: Process an association override for either an embedded object mapping, or a map mapping (element-collection, 1-M and M-M) containing an embeddable object as the value or key.protected void
processAssociationOverride(AssociationOverrideMetadata associationOverride, EmbeddableMapping embeddableMapping, MetadataDescriptor owningDescriptor)
INTERNAL: Process an association override for either an embedded object mapping, or a map mapping (element-collection, 1-M and M-M) containing an embeddable object as the value or key.protected void
processForeignKeyRelationship(ObjectReferenceMapping mapping)
INTERNAL: Process the join columns for the owning side of a one to one mapping.protected void
processId(OneToOneMapping mapping)
INTERNAL: Used to process primary keys and DerivedIds.protected void
processMapsId(OneToOneMapping oneToOneMapping)
INTERNAL: Process the mapping keys from the maps id value.protected void
processMapsIdFields(OneToOneMapping oneToOneMapping, EmbeddedIdAccessor embeddedIdAccessor, MappingAccessor mapsIdAccessor)
INTERNAL: We're going to add field name translations where necessary.protected void
processOneToOnePrimaryKeyRelationship(OneToOneMapping mapping)
INTERNAL: Process the primary key join columns for the owning side of a one to one mapping.protected void
processOwningMappingKeys(OneToOneMapping mapping)
INTERNAL: Process the the correct metadata for the owning side of a one to one mapping.void
setId(Boolean id)
INTERNAL: Used for OX mapping.void
setMapsId(String mapsId)
INTERNAL: Used for OX mapping.void
setOptional(Boolean isOptional)
INTERNAL: Used for OX mapping.void
setPrimaryKeyForeignKey(PrimaryKeyForeignKeyMetadata primaryKeyForeignKey)
INTERNAL: Used for OX mapping.void
setPrimaryKeyJoinColumns(List<PrimaryKeyJoinColumnMetadata> primaryKeyJoinColumns)
INTERNAL: Used for OX mapping.-
Methods inherited from class org.eclipse.persistence.internal.jpa.metadata.accessors.mappings.RelationshipAccessor
addJoinTableRelationKeyFields, getBatchFetch, getCascade, getCascadeOnDelete, getDefaultTableForEntityMapKey, getFetch, getForeignKey, getJoinColumns, getJoinFetch, getJoinFields, getJoinTable, getJoinTableMetadata, getLoggingContext, getMappedBy, getNonCacheable, getOrphanRemoval, getOwningMapping, getPrivateOwned, getReferenceDescriptor, getTargetEntity, getTargetEntityName, hasJoinTable, hasMappedBy, isCascadeOnDelete, isLazy, isNonCacheable, isOrphanRemoval, isPrivateOwned, isValueHolderInterface, process, processBatchFetch, processCascadeTypes, processJoinTable, processMappedByRelationTable, processOrphanRemoval, processRelationshipMapping, setAccessorMethods, setBatchFetch, setCascade, setCascadeOnDelete, setFetch, setForeignKey, setJoinColumns, setJoinFetch, setJoinFields, setJoinTable, setMappedBy, setNonCacheable, setOrphanRemoval, setPrivateOwned, setTargetEntity, setTargetEntityName, usesIndirection
-
Methods inherited from class org.eclipse.persistence.internal.jpa.metadata.accessors.mappings.MappingAccessor
addConvert, addConvertMetadata, addFieldNameTranslation, addMapKeyConvert, getAnnotation, getAssociationOverrides, getAttributeName, getAttributeOverride, getAttributeOverrides, getClassAccessor, getColumn, getConverts, getDatabaseField, getEnumerated, getField, getForeignKey, getGetMethodName, getJoinColumns, getJoinColumnsAndValidate, getLob, getMapKey, getMapKeyConverts, getMapKeyReferenceClass, getMapKeyReferenceClassName, getMapKeyReferenceClassWithGenerics, getMapping, getOwningDescriptor, getOwningDescriptors, getRawClass, getRawClassWithGenerics, getReferenceAccessors, getReferenceClassFromGeneric, getReferenceClassName, getReferenceClassWithGenerics, getReferenceDatabaseTable, getSetMethodName, getTemporal, hasAttributeOverride, hasEnumerated, hasLob, hasMapKey, hasReturnInsert, hasReturnUpdate, hasTemporal, initXMLMappingAccessor, isAnnotationPresent, isBasic, isBasicCollection, isBasicMap, isCollectionAccessor, isDerivedIdClass, isDirectCollection, isDirectEmbeddableCollection, isEmbedded, isEmbeddedId, isEnumerated, isId, isLob, isManyToMany, isManyToOne, isMapAccessor, isMappedKeyMapAccessor, isMultitenantId, isOneToMany, isOneToOne, isPrimitiveWrapperClass, isProcessed, isRelationship, isSerialized, isTemporal, isTimeClass, isTransient, isValidSerializedType, isVariableOneToOne, processAssociationOverrides, processAttributeOverrides, processContainerPolicyAndIndirection, processConvert, processConverts, processDirectMapKeyClass, processEmbeddableMapKeyClass, processEntityMapKeyClass, processEnumerated, processForeignKeyRelationship, processIndirection, processJoinFetch, processLob, processMapKeyClass, processMappingConverter, processMappingKeyConverter, processMappingValueConverter, processProperties, processProperty, processReturnInsert, processReturnInsertAndUpdate, processReturnUpdate, processSerialized, processSerialized, processTemporal, setAttributeType, setClassAccessor, setField, setIndirectionPolicy, setMapping, setOverrideMapping, setTemporal, toString, updatePrimaryKeyField, usesFieldAccess, usesPropertyAccess, usesVirtualAccess
-
Methods inherited from class org.eclipse.persistence.internal.jpa.metadata.accessors.MetadataAccessor
getAccess, getAccessibleObject, getAccessMethods, getAnnotatedElement, getAnnotatedElementName, getAnnotation, getConverters, getDefaultAttributeName, getDescriptor, getDescriptorJavaClass, getHashPartitioning, getIdentifier, getJavaClass, getJavaClassName, getName, getObjectTypeConverters, getPartitioned, getPartitioning, getPinnedPartitioning, getProperties, getRangePartitioning, getReferencedField, getReferencedField, getReplicationPartitioning, getRoundRobinPartitioning, getSerializedConverters, getStructConverters, getTypeConverters, getUnionPartitioning, getUpperCaseShortJavaClassName, getValue, getValue, getValuePartitioning, hasAccess, hasAccessMethods, initAccess, initXMLAccessor, isAnnotationPresent, merge, processConverters, processCustomConverters, processObjectTypeConverters, processPartitioned, processPartitioning, processPrimaryKeyJoinColumns, processSerializedConverters, processStructConverters, processTable, processTypeConverters, setAccess, setAccessMethods, setConverters, setDescriptor, setHashPartitioning, setName, setObjectTypeConverters, setPartitioned, setPartitioning, setPinnedPartitioning, setProperties, setRangePartitioning, setReplicationPartitioning, setRoundRobinPartitioning, setSerializedConverters, setStructConverters, setTypeConverters, setUnionPartitioning, setValuePartitioning
-
Methods inherited from class org.eclipse.persistence.internal.jpa.metadata.ORMetadata
getAccessibleObjectName, getAnnotation, getBoxedType, getDatabaseTypeEnum, getEntityMappings, getFullyQualifiedClassName, getJavaClass, getJavaClassName, getLoader, getLocation, getLogger, getMetadataClass, getMetadataClass, getMetadataClass, getMetadataFactory, getName, getPrimitiveClassForName, getProject, getText, getXMLElement, hasIdentifier, hasText, initXMLClassName, initXMLObject, initXMLObjects, initXMLTextObject, loadedFromAnnotation, loadedFromEclipseLinkXML, loadedFromXML, mergeORObjectLists, mergeORObjects, mergeSimpleObjects, reloadEntity, reloadMappedSuperclass, setAccessibleObject, setEntityMappings, setFieldName, setFieldName, setProject, shouldOverride, valuesMatch, valuesMatch
-
-
-
-
Constructor Detail
-
ObjectAccessor
protected ObjectAccessor(String xmlElement)
INTERNAL: Used for OX mapping.
-
ObjectAccessor
protected ObjectAccessor(MetadataAnnotation annotation, MetadataAnnotatedElement annotatedElement, ClassAccessor classAccessor)
INTERNAL:
-
-
Method Detail
-
equals
public boolean equals(Object objectToCompare)
INTERNAL:- Overrides:
equals
in classRelationshipAccessor
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classRelationshipAccessor
-
derivesId
public boolean derivesId()
INTERNAL: Return true is this accessor is a derived id accessor.- Overrides:
derivesId
in classMappingAccessor
- See Also:
ObjectAccessor
-
getAttributeType
public String getAttributeType()
INTERNAL: The attribute type for virtual object accessors is the target entity.- Overrides:
getAttributeType
in classMappingAccessor
-
getDefaultFetchType
public String getDefaultFetchType()
INTERNAL: Return the default fetch type for an object mapping.- Specified by:
getDefaultFetchType
in classRelationshipAccessor
-
getId
public Boolean getId()
INTERNAL:
-
getMapsId
public String getMapsId()
INTERNAL: Used for OX mapping.
-
getPrimaryKeyForeignKey
public PrimaryKeyForeignKeyMetadata getPrimaryKeyForeignKey()
INTERNAL: Used for OX mapping.
-
getPrimaryKeyJoinColumns
public List<PrimaryKeyJoinColumnMetadata> getPrimaryKeyJoinColumns()
INTERNAL: Used for OX mapping.
-
getOptional
public Boolean getOptional()
INTERNAL: Used for OX mapping.
-
getReferenceClass
public MetadataClass getReferenceClass()
INTERNAL: If a target entity is specified in metadata, it will be set as the reference class, otherwise we will use the raw class.- Overrides:
getReferenceClass
in classMappingAccessor
-
getSimplePKType
protected MetadataClass getSimplePKType()
INTERNAL: Used to process primary keys and DerivedIds.
-
hasAttributeType
public boolean hasAttributeType()
INTERNAL: Object accessors don't require a separate attribute-type specification in XML, instead they can use the reference class to determine the attribute-type.- Overrides:
hasAttributeType
in classMappingAccessor
-
hasId
protected boolean hasId()
INTERNAL:
-
hasMapsId
protected boolean hasMapsId()
INTERNAL:
-
initManyToOneMapping
protected ObjectReferenceMapping initManyToOneMapping()
INTERNAL: Initialize a ManyToOneMapping.
-
initOneToOneMapping
protected ObjectReferenceMapping initOneToOneMapping()
INTERNAL: Initialize a OneToOneMapping.
-
initXMLObject
public void initXMLObject(MetadataAccessibleObject accessibleObject, XMLEntityMappings entityMappings)
INTERNAL:- Overrides:
initXMLObject
in classRelationshipAccessor
-
isOneToOnePrimaryKeyRelationship
public boolean isOneToOnePrimaryKeyRelationship()
INTERNAL: Return true if this accessor represents a 1-1 primary key relationship.
-
isOptional
public boolean isOptional()
INTERNAL:
-
processAssociationOverride
protected void processAssociationOverride(AssociationOverrideMetadata associationOverride, EmbeddableMapping embeddableMapping, MetadataDescriptor owningDescriptor)
INTERNAL: Process an association override for either an embedded object mapping, or a map mapping (element-collection, 1-M and M-M) containing an embeddable object as the value or key.- Overrides:
processAssociationOverride
in classMappingAccessor
-
processAssociationOverride
protected void processAssociationOverride(AssociationOverrideMetadata associationOverride, EmbeddableMapping embeddableMapping, DatabaseTable defaultTable, MetadataDescriptor owningDescriptor)
INTERNAL: Process an association override for either an embedded object mapping, or a map mapping (element-collection, 1-M and M-M) containing an embeddable object as the value or key.
-
processId
protected void processId(OneToOneMapping mapping)
INTERNAL: Used to process primary keys and DerivedIds.
-
processMapsId
protected void processMapsId(OneToOneMapping oneToOneMapping)
INTERNAL: Process the mapping keys from the maps id value.
-
processMapsIdFields
protected void processMapsIdFields(OneToOneMapping oneToOneMapping, EmbeddedIdAccessor embeddedIdAccessor, MappingAccessor mapsIdAccessor)
INTERNAL: We're going to add field name translations where necessary. If the user specified (erroneously that is) attribute overrides this will override them.
-
processForeignKeyRelationship
protected void processForeignKeyRelationship(ObjectReferenceMapping mapping)
INTERNAL: Process the join columns for the owning side of a one to one mapping. The default pk and pk field names are used only with single primary key entities. The processor should never get as far as to use them with entities that have a composite primary key (validation exception will be thrown).
-
processOneToOnePrimaryKeyRelationship
protected void processOneToOnePrimaryKeyRelationship(OneToOneMapping mapping)
INTERNAL: Process the primary key join columns for the owning side of a one to one mapping. The default pk and pk field names are used only with single primary key entities. The processor should never get as far as to use them with entities that have a composite primary key (validation exception will be thrown).
-
processOwningMappingKeys
protected void processOwningMappingKeys(OneToOneMapping mapping)
INTERNAL: Process the the correct metadata for the owning side of a one to one mapping. Note, the order of checking is important, that is, check for a mapsId first.
-
setId
public void setId(Boolean id)
INTERNAL: Used for OX mapping.
-
setMapsId
public void setMapsId(String mapsId)
INTERNAL: Used for OX mapping.
-
setOptional
public void setOptional(Boolean isOptional)
INTERNAL: Used for OX mapping.
-
setPrimaryKeyForeignKey
public void setPrimaryKeyForeignKey(PrimaryKeyForeignKeyMetadata primaryKeyForeignKey)
INTERNAL: Used for OX mapping.
-
setPrimaryKeyJoinColumns
public void setPrimaryKeyJoinColumns(List<PrimaryKeyJoinColumnMetadata> primaryKeyJoinColumns)
INTERNAL: Used for OX mapping.
-
-