Top Description Fields Constructors Methods
org.eclipse.persistence.internal.jpa.metadata.accessors.classes

public Class EmbeddableAccessor

extends ClassAccessor
Class Inheritance
Imports
java.util.HashMap, .List, .Map, org.eclipse.persistence.annotations.Cache, org.eclipse.persistence.exceptions.ValidationException, org.eclipse.persistence.internal.jpa.metadata.MetadataDescriptor, .MetadataLogger, .MetadataProject, org.eclipse.persistence.internal.jpa.metadata.accessors.objects.MetadataAnnotation, .MetadataClass

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.
Author
Guy Pelletier
Since
EclipseLink 1.0

Field Summary

Modifier and TypeField and Description
private Map<String, ClassAccessor>

Constructor Summary

AccessConstructor and Description
public
EmbeddableAccessor()

INTERNAL:

public

Method Summary

Modifier and TypeMethod and Description
protected void
addEmbeddingAccessor(ClassAccessor embeddingAccessor)

INTERNAL: Embedding accessors are those accessors that actually embed the embeddable class with an embedded mapping.

public void
addEmbeddingAccessors(Map<String, ClassAccessor> embeddingAccessors)

INTERNAL:

public void
addOwningDescriptor(MetadataDescriptor owningDescriptor)

INTERNAL:

public void
addOwningDescriptors(List<MetadataDescriptor> owningDescriptors)

INTERNAL:

protected void
addPotentialEmbeddableAccessor(MetadataClass potentialEmbeddableClass, ClassAccessor embeddingAccessor)

Overrides org.eclipse.persistence.internal.jpa.metadata.accessors.classes.ClassAccessor.addPotentialEmbeddableAccessor.

INTERNAL Ensure any embeddable classes that are discovered during pre-process are added to the project.
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.

public Map<String, ClassAccessor>
public MetadataDescriptor
public boolean
isEmbeddableAccessor()

Overrides org.eclipse.persistence.internal.jpa.metadata.accessors.classes.ClassAccessor.isEmbeddableAccessor.

INTERNAL: Return true if this accessor represents an embeddable accessor.
public void
preProcess()

Overrides org.eclipse.persistence.internal.jpa.metadata.accessors.classes.ClassAccessor.preProcess.

INTERNAL: The pre-process method is called during regular deployment and metadata processing.
public void
preProcessForCanonicalModel()

Overrides org.eclipse.persistence.internal.jpa.metadata.accessors.classes.ClassAccessor.preProcessForCanonicalModel.

INTERNAL: The pre-process for canonical model method is called (and only called) during the canonical model generation.
protected void
preProcessMappedSuperclassMetadata(MappedSuperclassAccessor mappedSuperclass)

Overrides org.eclipse.persistence.internal.jpa.metadata.accessors.classes.ClassAccessor.preProcessMappedSuperclassMetadata.

INTERNAL Sub classes (Entity and Embeddable) must override this method to control the metadata that is processed for their context.
public void
process()

Overrides org.eclipse.persistence.internal.jpa.metadata.accessors.classes.ClassAccessor.process.

INTERNAL: Process the metadata from this embeddable class.
public void
processAccessMethods()

INTERNAL: For VIRTUAL access we need to look for default access methods that we need to use with our mapping attributes.

protected void
processAccessType()

Implements abstract org.eclipse.persistence.internal.jpa.metadata.accessors.classes.ClassAccessor.processAccessType.

INTERNAL: Process the access type of this embeddable.
protected void
processMappedSuperclassMetadata(MappedSuperclassAccessor mappedSuperclass)

Overrides org.eclipse.persistence.internal.jpa.metadata.accessors.classes.ClassAccessor.processMappedSuperclassMetadata.

INTERNAL From an embeddable we need pair down what we process as things like ID metadata does not apply.
Inherited from org.eclipse.persistence.internal.jpa.metadata.accessors.classes.ClassAccessor:
addAccessoraddAccessorFieldsaddAccessorMethodsaddAccessorsaddPotentialMappedSuperclassbuildAccessorclearMappedSuperclassesAndInheritanceParentsclearPreProcessedequalsexcludeDefaultMappingsgetAccessibleFieldgetAccessibleMethodgetAccessibleVirtualMethodgetAccessTypegetAnnotationgetAssociationOverridesgetAttributeOverridesgetAttributesgetChangeTrackinggetClassNamegetCloneCopyPolicygetCopyPolicygetCustomCopyPolicygetCustomizerClassgetCustomizerClassNamegetDescriptiongetExcludeDefaultMappingsgetIdentifiergetInstantiationCopyPolicygetJavaClassgetJavaClassNamegetMappedSuperclassesgetMetadataCompletegetNoSqlgetOracleArrayTypesgetOracleObjectTypesgetOwningDescriptorsgetParentClassgetParentClassNamegetPLSQLRecordsgetPLSQLTablesgetStructhasDerivedIdhashCodehasParentClassignoreAnnotationsinitXMLClassAccessorinitXMLObjectisAnnotationPresentisClassAccessorisEntityAccessorisMappedSuperclassisMetadataCompleteisPreProcessedisProcessedmergeprocessAssociationOverrideprocessAssociationOverridesprocessAttributeOverrideprocessAttributeOverridesprocessChangeTrackingprocessComplexMetadataTypesprocessCopyPolicyprocessCustomizerprocessDerivedIdprocessMappingAccessorsprocessNoSqlprocessParentClassprocessPropertiesprocessStructprocessVirtualClassresolveGenericTypessetAssociationOverridessetAttributeOverridessetAttributessetChangeTrackingsetClassNamesetCloneCopyPolicysetCustomCopyPolicysetCustomizerClassNamesetDescriptionsetExcludeDefaultMappingssetInstantiationCopyPolicysetIsPreProcessedsetIsProcessedsetJavaClasssetMetadataCompletesetNoSqlsetOracleArrayTypessetOracleObjectTypessetParentClasssetParentClassNamesetPLSQLRecordssetPLSQLTablessetStructtoStringusesFieldAccessusesPropertyAccessusesVirtualAccess

Field Detail

m_embeddingAccessorsback to summary
private Map<String, ClassAccessor> m_embeddingAccessors

Constructor Detail

EmbeddableAccessorback to summary
public EmbeddableAccessor()

INTERNAL:

EmbeddableAccessorback to summary
public EmbeddableAccessor(MetadataAnnotation annotation, MetadataClass cls, MetadataProject project)

INTERNAL:

Method Detail

addEmbeddingAccessorback to summary
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.

addEmbeddingAccessorsback to summary
public void addEmbeddingAccessors(Map<String, ClassAccessor> embeddingAccessors)

INTERNAL:

addOwningDescriptorback to summary
public void addOwningDescriptor(MetadataDescriptor owningDescriptor)

INTERNAL:

addOwningDescriptorsback to summary
public void addOwningDescriptors(List<MetadataDescriptor> owningDescriptors)

INTERNAL:

addPotentialEmbeddableAccessorback to summary
protected void addPotentialEmbeddableAccessor(MetadataClass potentialEmbeddableClass, ClassAccessor embeddingAccessor)

Overrides org.eclipse.persistence.internal.jpa.metadata.accessors.classes.ClassAccessor.addPotentialEmbeddableAccessor.

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.

Annotations
@Override
discoverMappedSuperclassesAndInheritanceParentsback to summary
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).

getEmbeddingAccessorsback to summary
public Map<String, ClassAccessor> getEmbeddingAccessors()

INTERNAL:

getOwningDescriptorback to summary
public MetadataDescriptor getOwningDescriptor()

Overrides org.eclipse.persistence.internal.jpa.metadata.accessors.classes.ClassAccessor.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

Annotations
@Override
isEmbeddableAccessorback to summary
public boolean isEmbeddableAccessor()

Overrides org.eclipse.persistence.internal.jpa.metadata.accessors.classes.ClassAccessor.isEmbeddableAccessor.

INTERNAL: Return true if this accessor represents an embeddable accessor.

Annotations
@Override
preProcessback to summary
public void preProcess()

Overrides org.eclipse.persistence.internal.jpa.metadata.accessors.classes.ClassAccessor.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.

Annotations
@Override
preProcessForCanonicalModelback to summary
public void preProcessForCanonicalModel()

Overrides org.eclipse.persistence.internal.jpa.metadata.accessors.classes.ClassAccessor.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.

Annotations
@Override
preProcessMappedSuperclassMetadataback to summary
protected void preProcessMappedSuperclassMetadata(MappedSuperclassAccessor mappedSuperclass)

Overrides org.eclipse.persistence.internal.jpa.metadata.accessors.classes.ClassAccessor.preProcessMappedSuperclassMetadata.

INTERNAL Sub classes (Entity and Embeddable) must override this method to control the metadata that is processed for their context.

Annotations
@Override
processback to summary
public void process()

Overrides org.eclipse.persistence.internal.jpa.metadata.accessors.classes.ClassAccessor.process.

INTERNAL: Process the metadata from this embeddable class.

Annotations
@Override
processAccessMethodsback to summary
public void processAccessMethods()

INTERNAL: For VIRTUAL access we need to look for default access methods that we need to use with our mapping attributes.

processAccessTypeback to summary
protected void processAccessType()

Implements abstract org.eclipse.persistence.internal.jpa.metadata.accessors.classes.ClassAccessor.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.

Annotations
@Override
processMappedSuperclassMetadataback to summary
protected void processMappedSuperclassMetadata(MappedSuperclassAccessor mappedSuperclass)

Overrides org.eclipse.persistence.internal.jpa.metadata.accessors.classes.ClassAccessor.processMappedSuperclassMetadata.

INTERNAL From an embeddable we need pair down what we process as things like ID metadata does not apply.

Annotations
@Override