Module org.eclipse.persistence.jpa
Class EmbeddableAccessor
- 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.classes.ClassAccessor
-
- org.eclipse.persistence.internal.jpa.metadata.accessors.classes.EmbeddableAccessor
-
public class EmbeddableAccessor extends ClassAccessor
INTERNAL: An embeddable 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:
- EclipseLink 1.0
- Author:
- Guy Pelletier
-
-
Field Summary
-
Fields inherited from class org.eclipse.persistence.internal.jpa.metadata.ORMetadata
m_project
-
-
Constructor Summary
Constructors Constructor Description EmbeddableAccessor()INTERNAL:EmbeddableAccessor(MetadataAnnotation annotation, MetadataClass cls, MetadataProject project)INTERNAL:
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddEmbeddingAccessor(ClassAccessor embeddingAccessor)INTERNAL: Embedding accessors are those accessors that actually embed the embeddable class with an embedded mapping.voidaddEmbeddingAccessors(Map<String,ClassAccessor> embeddingAccessors)INTERNAL:voidaddOwningDescriptor(MetadataDescriptor owningDescriptor)INTERNAL:voidaddOwningDescriptors(List<MetadataDescriptor> owningDescriptors)INTERNAL:protected voidaddPotentialEmbeddableAccessor(MetadataClass potentialEmbeddableClass, ClassAccessor embeddingAccessor)INTERNAL Ensure any embeddable classes that are discovered during pre-process are added to the project.protected voiddiscoverMappedSuperclassesAndInheritanceParents(boolean addMappedSuperclassAccessors)INTERNAL: Build a list of classes that are decorated with a MappedSuperclass annotation or that are tagged as a mapped-superclass in an XML document.Map<String,ClassAccessor>getEmbeddingAccessors()INTERNAL:MetadataDescriptorgetOwningDescriptor()INTERNAL: So, here's the deal ...booleanisEmbeddableAccessor()INTERNAL: Return true if this accessor represents an embeddable accessor.voidpreProcess()INTERNAL: The pre-process method is called during regular deployment and metadata processing.voidpreProcessForCanonicalModel()INTERNAL: The pre-process for canonical model method is called (and only called) during the canonical model generation.protected voidpreProcessMappedSuperclassMetadata(MappedSuperclassAccessor mappedSuperclass)INTERNAL Sub classes (Entity and Embeddable) must override this method to control the metadata that is processed for their context.voidprocess()INTERNAL: Process the metadata from this embeddable class.voidprocessAccessMethods()INTERNAL: For VIRTUAL access we need to look for default access methods that we need to use with our mapping attributes.protected voidprocessAccessType()INTERNAL: Process the access type of this embeddable.protected voidprocessMappedSuperclassMetadata(MappedSuperclassAccessor mappedSuperclass)INTERNAL From an embeddable we need pair down what we process as things like ID metadata does not apply.-
Methods inherited from class org.eclipse.persistence.internal.jpa.metadata.accessors.classes.ClassAccessor
addAccessor, addAccessorFields, addAccessorMethods, addAccessors, addPotentialMappedSuperclass, buildAccessor, clearMappedSuperclassesAndInheritanceParents, clearPreProcessed, equals, excludeDefaultMappings, getAccessibleField, getAccessibleMethod, getAccessibleVirtualMethod, getAccessType, getAnnotation, getAssociationOverrides, getAttributeOverrides, getAttributes, getChangeTracking, getClassName, getCloneCopyPolicy, getCopyPolicy, getCustomCopyPolicy, getCustomizerClass, getCustomizerClassName, getDescription, getExcludeDefaultMappings, getIdentifier, getInstantiationCopyPolicy, getJavaClass, getJavaClassName, getMappedSuperclasses, getMetadataComplete, getNoSql, getOracleArrayTypes, getOracleObjectTypes, getOwningDescriptors, getParentClass, getParentClassName, getPLSQLRecords, getPLSQLTables, getStruct, hasDerivedId, hashCode, hasParentClass, ignoreAnnotations, initXMLClassAccessor, initXMLObject, isAnnotationPresent, isClassAccessor, isEntityAccessor, isMappedSuperclass, isMetadataComplete, isPreProcessed, isProcessed, merge, processAssociationOverride, processAssociationOverrides, processAttributeOverride, processAttributeOverrides, processChangeTracking, processComplexMetadataTypes, processCopyPolicy, processCustomizer, processDerivedId, processMappingAccessors, processNoSql, processParentClass, processProperties, processStruct, processVirtualClass, resolveGenericTypes, setAssociationOverrides, setAttributeOverrides, setAttributes, setChangeTracking, setClassName, setCloneCopyPolicy, setCustomCopyPolicy, setCustomizerClassName, setDescription, setExcludeDefaultMappings, setInstantiationCopyPolicy, setIsPreProcessed, setIsProcessed, setJavaClass, setMetadataComplete, setNoSql, setOracleArrayTypes, setOracleObjectTypes, setParentClass, setParentClassName, setPLSQLRecords, setPLSQLTables, setStruct, toString, usesFieldAccess, usesPropertyAccess, usesVirtualAccess
-
Methods inherited from class org.eclipse.persistence.internal.jpa.metadata.accessors.MetadataAccessor
getAccess, getAccessibleObject, getAccessMethods, getAnnotatedElement, getAnnotatedElementName, getAnnotation, getAttributeName, getConverters, getDefaultAttributeName, getDescriptor, getDescriptorJavaClass, getHashPartitioning, getName, getObjectTypeConverters, getPartitioned, getPartitioning, getPinnedPartitioning, getProperties, getRangePartitioning, getReferencedField, getReferencedField, getReplicationPartitioning, getRoundRobinPartitioning, getSerializedConverters, getStructConverters, getTypeConverters, getUnionPartitioning, getUpperCaseShortJavaClassName, getValue, getValue, getValuePartitioning, hasAccess, hasAccessMethods, initAccess, initXMLAccessor, isAnnotationPresent, 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
-
EmbeddableAccessor
public EmbeddableAccessor()
INTERNAL:
-
EmbeddableAccessor
public EmbeddableAccessor(MetadataAnnotation annotation, MetadataClass cls, MetadataProject project)
INTERNAL:
-
-
Method Detail
-
addEmbeddingAccessor
protected void addEmbeddingAccessor(ClassAccessor embeddingAccessor)
INTERNAL: Embedding accessors are those accessors that actually embed the embeddable class with an embedded mapping. We use this list to extract and validate the access type of this embeddable when the embeddable does not specify an explicit access type.
-
addEmbeddingAccessors
public void addEmbeddingAccessors(Map<String,ClassAccessor> embeddingAccessors)
INTERNAL:
-
addOwningDescriptor
public void addOwningDescriptor(MetadataDescriptor owningDescriptor)
INTERNAL:
-
addOwningDescriptors
public void addOwningDescriptors(List<MetadataDescriptor> owningDescriptors)
INTERNAL:
-
addPotentialEmbeddableAccessor
protected void addPotentialEmbeddableAccessor(MetadataClass potentialEmbeddableClass, ClassAccessor embeddingAccessor)
INTERNAL Ensure any embeddable classes that are discovered during pre-process are added to the project. The newly discovered embeddable accesors will also be pre-processed now as well.- Overrides:
addPotentialEmbeddableAccessorin classClassAccessor- See Also:
processStage1()
-
discoverMappedSuperclassesAndInheritanceParents
protected void discoverMappedSuperclassesAndInheritanceParents(boolean addMappedSuperclassAccessors)
INTERNAL: Build a list of classes that are decorated with a MappedSuperclass annotation or that are tagged as a mapped-superclass in an XML document. This method will also do a couple other things as well since we are traversing the parent classes: - Build a map of generic types specified and will be used to resolve actual class types for mappings. - save mapped-superclass descriptors on the project for later use by the Metamodel API We don't support embeddable inheritance yet. When that is added, this method will need to change and in fact we may be able to re-use the existing discover method from EntityAccessor (with minor tweaks).
-
getEmbeddingAccessors
public Map<String,ClassAccessor> getEmbeddingAccessors()
INTERNAL:
-
getOwningDescriptor
public MetadataDescriptor getOwningDescriptor()
INTERNAL: So, here's the deal ... this method typically gets called when defaulting pk's name, primary table names etc. for various mappings. The problem however is that we go beyond the spec and allow more mappings to be specified on embeddable classes. For example, a M-M would default its join table and join columns using the info from its owning descriptor. The problem then is ... what to do when this embedabble has multiple owning descriptors? That is, is shared. Right now, their pk names from the owners better be same or mappings must be fully specified and not use any defaults. I think that is somewhat ok given we're going beyond the spec and TopLink doesn't even support it anyway??? So the stance is, we'll allow the extra mappings on embeddables that are not shared, however on shared cases there are restrictions. Users should use mapped superclasses when they have a need to share complex embeddables. Or they can write customizers to modify their embeddable descriptors after initialize (after they have been cloned) Future: the metadata processing 'could' set all necessary (per owning descriptor) metadata and have the descriptor initialize code handle it. Metadata processing would process embeddable classes as it currently does for MappedSuperclasses. Clone them and process under each owning entity context. At descriptor initialize time, we would avoid cloning the aggregate descriptor and use the one metadata processing provided. Investigate further at a later date ... Callers to this method are ... BasicCollectionAccessor - processCollectionTable - defaults pk names from the owning descriptor. RelationshipAccessor - processJoinTable - defaults the join table name and the source field name OneToManyAccessor - processUnidirectionalOneToManyMapping - defaults the pk field and table. MappingAccessor - processAssociationOverride and updatePrimaryKeyField. ObjectAccessor - processId- Overrides:
getOwningDescriptorin classClassAccessor- See Also:
EmbeddableAccessor
-
isEmbeddableAccessor
public boolean isEmbeddableAccessor()
INTERNAL: Return true if this accessor represents an embeddable accessor.- Overrides:
isEmbeddableAccessorin classClassAccessor
-
preProcess
public void preProcess()
INTERNAL: The pre-process method is called during regular deployment and metadata processing. This method is called after each entity of the persistence unit has had an opportunity to pre-process itself first since we'll rely on owning entities for things like access type etc. The pre-process will run some validation. The order of processing is important, care must be taken if changes must be made.- Overrides:
preProcessin classClassAccessor
-
preProcessForCanonicalModel
public void preProcessForCanonicalModel()
INTERNAL: The pre-process for canonical model method is called (and only called) during the canonical model generation. The use of this pre-process allows us to remove some items from the regular pre-process that do not apply to the canonical model generation. The order of processing is important, care must be taken if changes must be made.- Overrides:
preProcessForCanonicalModelin classClassAccessor
-
preProcessMappedSuperclassMetadata
protected void preProcessMappedSuperclassMetadata(MappedSuperclassAccessor mappedSuperclass)
INTERNAL Sub classes (Entity and Embeddable) must override this method to control the metadata that is processed for their context.- Overrides:
preProcessMappedSuperclassMetadatain classClassAccessor- See Also:
EmbeddableAccessor
-
process
public void process()
INTERNAL: Process the metadata from this embeddable class.- Overrides:
processin classClassAccessor
-
processAccessMethods
public void processAccessMethods()
INTERNAL: For VIRTUAL access we need to look for default access methods that we need to use with our mapping attributes.
-
processAccessType
protected void processAccessType()
INTERNAL: Process the access type of this embeddable. If this embeddable is not embedded by at least one entity, it will not be processed. Therefore, embedding accessors can not be empty at this point.- Specified by:
processAccessTypein classClassAccessor
-
processMappedSuperclassMetadata
protected void processMappedSuperclassMetadata(MappedSuperclassAccessor mappedSuperclass)
INTERNAL From an embeddable we need pair down what we process as things like ID metadata does not apply.- Overrides:
processMappedSuperclassMetadatain classClassAccessor- See Also:
EmbeddableAccessor
-
-