Direct Known Subclasses:
EmbeddableAccessor, InterfaceAccessor, MappedSuperclassAccessor

public abstract class ClassAccessor extends MetadataAccessor
INTERNAL: A abstract class accessor. Holds common metadata for entities, embeddables and mapped superclasses. Key notes: - all metadata mapped from XML to this class must be compared in the equals method. - all metadata mapped from XML must be initialized in the initXMLObject method. - all 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
  • Constructor Details

  • Method Details

    • addAccessor

      protected void addAccessor(MappingAccessor accessor)
      INTERNAL: Add the accessor to the descriptor
    • addAccessors

      public void addAccessors()
      INTERNAL: Add the accessors from this class accessors java class to the descriptor tied to this class accessor. This method is called for every class accessor and is also called from parent class accessors to each of its subclasses of a TABLE_PER_CLASS inheritance strategy. Add accessors is called in the preProcess stage and must not be called until its owning class accessor has processed its access type.
    • addAccessorFields

      protected void addAccessorFields(boolean processingInverse)
      INTERNAL: Create mappings from the fields directly. If the mustBeExplicit flag is true, then we are processing the inverse of an explicit access setting and for a field to be processed it must have a Access(FIELD) setting.
    • addAccessorMethods

      protected void addAccessorMethods(boolean processingInverse)
      INTERNAL: Create mappings via the class properties. If the mustBeExplicit flag is true, then we are processing the inverse of an explicit access setting and for a field to be processed it must have a Access(PROPERTY) setting.
    • addPotentialEmbeddableAccessor

      protected void addPotentialEmbeddableAccessor(MetadataClass potentialEmbeddableClass, ClassAccessor embeddingAccessor)
      INTERNAL Add an embeddable class to the embeddable accessor list if it is indeed an embeddable. This method is overridden in EmbeddableAccessor and is called during pre-process. At the entity level all we want to do is set the owning descriptor whereas for nested embeddables they'll need the list of owning descriptors. Any nested embeddables will be discovered and pre-processed when pre-processing the known list of root embeddables.
      See Also:
    • addPotentialMappedSuperclass

      protected void addPotentialMappedSuperclass(MetadataClass metadataClass, boolean addMappedSuperclassAccessors)
      INTERNAL: Add mapped superclass accessors to inheriting entities. Add new descriptors for these mapped superclasses to the core project.
    • buildAccessor

      protected MappingAccessor buildAccessor(MetadataAnnotatedElement accessibleObject)
      INTERNAL: Create and return the appropriate accessor based on the accessible object given. Order of checking is important, careful when modifying or adding, check what the isXyz call does to determine if the accessor is of type xyz.
    • clearMappedSuperclassesAndInheritanceParents

      protected void clearMappedSuperclassesAndInheritanceParents()
      INTERNAL:
    • clearPreProcessed

      public void clearPreProcessed()
      INTERNAL: In some cases the pre-processing may need to be re-done. Namely, during the canonical model generation between compile rounds.
    • equals

      public boolean equals(Object objectToCompare)
      INTERNAL:
      Overrides:
      equals in class MetadataAccessor
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class MetadataAccessor
    • excludeDefaultMappings

      public boolean excludeDefaultMappings()
      INTERNAL: Return true if this class accessor has been set to metadata complete.
    • getAccessibleField

      protected MetadataField getAccessibleField(MappingAccessor accessor)
      INTERNAL: Return the accessible field for the given mapping accessor. Validation is performed on the existence of the field.
    • getAccessibleMethod

      protected MetadataMethod getAccessibleMethod(MappingAccessor accessor)
      INTERNAL: Return the accessible method for the given mapping accessor. Validation is performed on the existence of the method by property name or by the access methods if specified.
    • getAccessibleVirtualMethod

      protected MetadataMethod getAccessibleVirtualMethod(MappingAccessor accessor)
      INTERNAL: This method should only be called when using virtual access and presumably for dynamic persistence. No method validation is done and either the access methods specified or the default get and set methods for name access will be used.
    • getAccessType

      public String getAccessType()
      INTERNAL: Return the access type of this accessor. Assumes all access processing has been performed before calling this method.
    • getAnnotation

      protected MetadataAnnotation getAnnotation(String annotation)
      INTERNAL: Return the annotation if it exists.
      Specified by:
      getAnnotation in class MetadataAccessor
    • getAssociationOverrides

      public List<AssociationOverrideMetadata> getAssociationOverrides()
      INTERNAL: Used for OX mapping.
    • getAttributeOverrides

      public List<AttributeOverrideMetadata> getAttributeOverrides()
      INTERNAL: Used for OX mapping.
    • getAttributes

      public XMLAttributes getAttributes()
      INTERNAL: Used for OX mapping.
    • getChangeTracking

      public ChangeTrackingMetadata getChangeTracking()
      INTERNAL: Used for OX mapping.
    • getClassName

      public String getClassName()
      INTERNAL: Used for OX mapping.
    • getCopyPolicy

      public CopyPolicyMetadata getCopyPolicy()
      INTERNAL:
    • getCloneCopyPolicy

      public CloneCopyPolicyMetadata getCloneCopyPolicy()
      INTERNAL: Used for OX mapping
    • getCustomCopyPolicy

      public CustomCopyPolicyMetadata getCustomCopyPolicy()
      INTERNAL: Used for OX mapping
    • getCustomizerClass

      public MetadataClass getCustomizerClass()
      INTERNAL:
    • getCustomizerClassName

      public String getCustomizerClassName()
      INTERNAL: Used for OX mapping.
    • getDescription

      public String getDescription()
      INTERNAL: Used for OX mapping.
    • getExcludeDefaultMappings

      public Boolean getExcludeDefaultMappings()
      INTERNAL: Used for OX mapping.
    • getIdentifier

      public String getIdentifier()
      INTERNAL: To satisfy the abstract getIdentifier() method from ORMetadata.
      Overrides:
      getIdentifier in class MetadataAccessor
      See Also:
    • getInstantiationCopyPolicy

      public InstantiationCopyPolicyMetadata getInstantiationCopyPolicy()
      INTERNAL: Used for OX mapping
    • getJavaClass

      public MetadataClass getJavaClass()
      INTERNAL: Return the java class that defines this accessor. It may be an entity, embeddable or mapped superclass.
      Overrides:
      getJavaClass in class MetadataAccessor
    • getJavaClassName

      public String getJavaClassName()
      INTERNAL: Return the java class name that defines this accessor. It may be an entity, embeddable or mapped superclass.
      Overrides:
      getJavaClassName in class MetadataAccessor
    • getMappedSuperclasses

      public List<MappedSuperclassAccessor> getMappedSuperclasses()
      INTERNAL: Return the mapped superclasses associated with this entity accessor. A call to discoverMappedSuperclassesAndInheritanceParents() should be made before calling this method.
      See Also:
    • getMetadataComplete

      public Boolean getMetadataComplete()
      INTERNAL: Used for OX mapping.
    • getNoSql

      public NoSqlMetadata getNoSql()
      INTERNAL: Used for OX mapping.
    • setNoSql

      public void setNoSql(NoSqlMetadata noSql)
      INTERNAL: Used for OX mapping.
    • getOwningDescriptor

      public MetadataDescriptor getOwningDescriptor()
      INTERNAL: In most cases the owning descriptor is the descriptor associated with this class accessor. Owning descriptors come into play when dealing with embeddable classes and their accessors. Processing certain accessors from an embeddable class requires knowledge of owning descriptors that require metadata settings from processing the embeddable metadata.
      See Also:
    • getOwningDescriptors

      public List<MetadataDescriptor> getOwningDescriptors()
      INTERNAL: In most cases the owning descriptors is the single descriptor associated with this class accessor. Owning descriptors come into play when dealing with shared embeddable classes (included nested) and their accessors. Processing certain accessors from an embeddable class requires knowledge of owning descriptors that require metadata settings from processing the embeddable metadata.
      See Also:
    • getParentClass

      protected MetadataClass getParentClass()
      INTERNAL:
    • getParentClassName

      public String getParentClassName()
      INTERNAL: Used for OX mapping.
    • getPLSQLRecords

      public List<PLSQLRecordMetadata> getPLSQLRecords()
      INTERNAL: Used for OX mapping.
    • getPLSQLTables

      public List<PLSQLTableMetadata> getPLSQLTables()
      INTERNAL: Used for OX mapping.
    • getStruct

      public StructMetadata getStruct()
      INTERNAL: Used for OX mapping.
    • hasDerivedId

      public boolean hasDerivedId()
      INTERNAL:
    • hasParentClass

      protected boolean hasParentClass()
      INTERNAL:
    • isMappedSuperclass

      public boolean isMappedSuperclass()
      INTERNAL: Return whether this ClassAccessor is a MappedSuperclassAccessor
    • isMetadataComplete

      public boolean isMetadataComplete()
      INTERNAL:
    • isPreProcessed

      public boolean isPreProcessed()
      INTERNAL: Return true if this accessor has been pre-processed.
    • isProcessed

      public boolean isProcessed()
      INTERNAL: Return true if this accessor has been processed.
      Specified by:
      isProcessed in class MetadataAccessor
    • ignoreAnnotations

      public boolean ignoreAnnotations()
      INTERNAL: Return true if this class accessor has been set to metadata complete.
    • initXMLClassAccessor

      public void initXMLClassAccessor(MetadataAccessibleObject accessibleObject, MetadataDescriptor descriptor, MetadataProject project, XMLEntityMappings entityMappings)
      INTERNAL: This method should be subclassed in those methods that need to do extra initialization.
    • initXMLObject

      public void initXMLObject(MetadataAccessibleObject accessibleObject, XMLEntityMappings entityMappings)
      INTERNAL:
      Overrides:
      initXMLObject in class MetadataAccessor
    • isAnnotationPresent

      public boolean isAnnotationPresent(String annotation)
      INTERNAL: Indicates whether the specified annotation is present on the annotated element for this accessor. Method checks against the metadata complete flag.
      Specified by:
      isAnnotationPresent in class MetadataAccessor
    • isClassAccessor

      public boolean isClassAccessor()
      INTERNAL: Return true if this accessor represents a class.
    • isEmbeddableAccessor

      public boolean isEmbeddableAccessor()
      INTERNAL: Return true if this accessor represents an embeddable class.
    • isEntityAccessor

      public boolean isEntityAccessor()
      INTERNAL: Return true if this accessor represents an entity class.
    • merge

      public void merge(ORMetadata metadata)
      INTERNAL: Generic class level merging details for entities, mapped superclasses and embeddables.
      Overrides:
      merge in class MetadataAccessor
    • preProcess

      public void preProcess()
      INTERNAL: The pre-process method is called during regular deployment and metadata processing.
    • 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.
    • preProcessMappedSuperclassMetadata

      protected void preProcessMappedSuperclassMetadata(MappedSuperclassAccessor mappedSuperclass)
      INTERNAL: Sub classes that support extending mapped superclasses should override this method to control what is pre-processed from a mapped superclass. By default it does full pre-processing.
      See Also:
    • process

      public void process()
      INTERNAL: This method should be overridden by all class accessors to process their specific class metadata first then call up to this method to process the common metadata.
      Specified by:
      process in class MetadataAccessor
    • processAccessType

      protected abstract void processAccessType()
      INTERNAL:
    • processAssociationOverride

      protected void processAssociationOverride(AssociationOverrideMetadata associationOverride)
      INTERNAL: Process the association override metadata specified on an entity or mapped superclass. For any given class, XML association overrides are always added first (see processAssociationOverrides()).
    • processAssociationOverrides

      protected void processAssociationOverrides()
      INTERNAL: Process the association override metadata specified on an entity or mapped superclass. Once the association overrides are processed from XML process the association overrides from annotations. This order of processing must be maintained.
    • processAttributeOverride

      protected void processAttributeOverride(AttributeOverrideMetadata attributeOverride)
      INTERNAL: Process the attribute override metadata specified on an entity or mapped superclass. For any given class, XML attribute overrides are always added first (see processAttributeOverrides()).
    • processAttributeOverrides

      protected void processAttributeOverrides()
      INTERNAL: Process the attribute override metadata specified on an entity or mapped superclass. Once the attribute overrides are processed from XML process the attribute overrides from annotations. This order of processing must be maintained.
    • processChangeTracking

      protected void processChangeTracking()
      INTERNAL: Process the change tracking setting for this accessor.
    • processComplexMetadataTypes

      public void processComplexMetadataTypes()
      Process PL/SQL record and table types, Oracle object array and XMLType types.
    • processCopyPolicy

      protected void processCopyPolicy()
      INTERNAL:
    • processCustomizer

      protected void processCustomizer()
      INTERNAL:
    • processDerivedId

      public void processDerivedId(HashSet<ClassAccessor> processing, HashSet<ClassAccessor> processed)
      INTERNAL: Allows for processing derived ids, either from an Id or MapsId specification. All referenced accessors are processed first to ensure the necessary fields are set before the derived id is processed and circular references are checked.
    • processMappedSuperclassMetadata

      protected void processMappedSuperclassMetadata(MappedSuperclassAccessor mappedSuperclass)
      INTERNAL Sub classes that support extending mapped superclasses should override this method to control what is processed from a mapped superclass. By default it does full processing.
      See Also:
    • processMappingAccessors

      public void processMappingAccessors()
      INTERNAL: Process the accessors for the given class.
    • processNoSql

      protected void processNoSql()
      INTERNAL: Check for and process a NoSql annotation and configure the correct descriptor type. NOTE: NoSql metadata is supported only on Entity and Embeddable.
    • processParentClass

      public void processParentClass()
      INTERNAL: If the user specified a parent class set it on the metadata class for this accessor. The parent class is only ever required in a VIRTUAL case when no java class file is available (otherwise we look at the class for the parent).
    • processProperties

      protected void processProperties()
      INTERNAL: Adds properties to the descriptor.
    • processStruct

      protected void processStruct()
      Check for and process a Struct annotation and configure the correct descriptor type. NOTE: Struct metadata is supported only on Entity and Embeddable.
    • processVirtualClass

      protected void processVirtualClass()
      INTERNAL: If this class accessor uses VIRTUAL access and is not accessible, add it to our list of virtual classes that will be dynamically created.
    • resolveGenericTypes

      protected void resolveGenericTypes(List<String> genericTypes, MetadataClass parent)
      INTERNAL: This method resolves generic types. Resolving generic types will be the responsibility of the metadata factory since each factory could have its own means to do so and not respect a generic format on the metadata objects.
    • setAssociationOverrides

      public void setAssociationOverrides(List<AssociationOverrideMetadata> associationOverrides)
      INTERNAL: Used for OX mapping.
    • setAttributeOverrides

      public void setAttributeOverrides(List<AttributeOverrideMetadata> attributeOverrides)
      INTERNAL: Used for OX mapping.
    • setAttributes

      public void setAttributes(XMLAttributes attributes)
      INTERNAL: Used for OX mapping.
    • setChangeTracking

      public void setChangeTracking(ChangeTrackingMetadata changeTracking)
      INTERNAL: Used for OX mapping.
    • setClassName

      public void setClassName(String className)
      INTERNAL: Used for OX mapping.
    • setCloneCopyPolicy

      public void setCloneCopyPolicy(CloneCopyPolicyMetadata copyPolicy)
      INTERNAL: set the copy policy metadata
    • setCustomCopyPolicy

      public void setCustomCopyPolicy(CustomCopyPolicyMetadata copyPolicy)
      INTERNAL: set the copy policy metadata
    • setCustomizerClassName

      public void setCustomizerClassName(String customizerClassName)
      INTERNAL: Used for OX mapping.
    • setDescription

      public void setDescription(String description)
      INTERNAL: Used for OX mapping.
    • setExcludeDefaultMappings

      public void setExcludeDefaultMappings(Boolean excludeDefaultMappings)
      INTERNAL: Used for OX mapping.
    • setInstantiationCopyPolicy

      public void setInstantiationCopyPolicy(InstantiationCopyPolicyMetadata copyPolicy)
      INTERNAL: set the copy policy metadata
    • setIsPreProcessed

      protected void setIsPreProcessed()
      INTERNAL:
    • setIsProcessed

      protected void setIsProcessed()
      INTERNAL:
    • setJavaClass

      public void setJavaClass(MetadataClass cls)
      INTERNAL: Set the java class for this accessor. This is currently called after the class loader has changed and we are adding entity listeners.
    • setMetadataComplete

      public void setMetadataComplete(Boolean metadataComplete)
      INTERNAL: Used for OX mapping.
    • setParentClass

      protected void setParentClass(MetadataClass parentClass)
      INTERNAL:
    • setParentClassName

      public void setParentClassName(String parentClassName)
      INTERNAL: Used for OX mapping.
    • setPLSQLRecords

      public void setPLSQLRecords(List<PLSQLRecordMetadata> records)
      INTERNAL: Used for OX mapping.
    • setPLSQLTables

      public void setPLSQLTables(List<PLSQLTableMetadata> tables)
      INTERNAL: Used for OX mapping.
    • setStruct

      public void setStruct(StructMetadata struct)
      INTERNAL: Used for OX mapping.
    • toString

      public String toString()
      INTERNAL:
      Overrides:
      toString in class Object
    • usesFieldAccess

      public boolean usesFieldAccess()
      INTERNAL: Returns true if this class uses field access. It will first check for an explicit access type specification, otherwise will use the default access as specified on the descriptor for this accessor since we may be processing a mapped superclass.
    • usesPropertyAccess

      public boolean usesPropertyAccess()
      INTERNAL: Returns true if this class uses property access. It will first check for an explicit access type specification, otherwise will use the default access as specified on the descriptor for this accessor since we may be processing a mapped superclass.
    • usesVirtualAccess

      public boolean usesVirtualAccess()
      INTERNAL: Returns true if this class uses virtual access. It will first check for an explicit access type specification, otherwise will use the default access as specified on the descriptor for this accessor since we may be processing a mapped superclass.
    • getOracleObjectTypes

      public List<OracleObjectTypeMetadata> getOracleObjectTypes()
      Returns the list of OracleObjectType instances.
    • setOracleObjectTypes

      public void setOracleObjectTypes(List<OracleObjectTypeMetadata> oracleObjectTypes)
      Sets the list of OracleObjectType instances.
    • getOracleArrayTypes

      public List<OracleArrayTypeMetadata> getOracleArrayTypes()
      Returns the list of OracleArrayType instances.
    • setOracleArrayTypes

      public void setOracleArrayTypes(List<OracleArrayTypeMetadata> oracleArrayTypes)
      Sets the list of OracleArrayType instances.