Module org.eclipse.persistence.jpa
Class MetadataAccessor
- java.lang.Object
-
- org.eclipse.persistence.internal.jpa.metadata.ORMetadata
-
- org.eclipse.persistence.internal.jpa.metadata.accessors.MetadataAccessor
-
- Direct Known Subclasses:
ClassAccessor,MappingAccessor
public abstract class MetadataAccessor extends ORMetadata
INTERNAL: Common metadata accessor level for mappings and classes. 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.ORMetadata
m_project
-
-
Constructor Summary
Constructors Constructor Description MetadataAccessor(String xmlElement)INTERNAL: Used for OX mapping.MetadataAccessor(MetadataAnnotation annotation, MetadataAccessibleObject accessibleObject, MetadataDescriptor descriptor, MetadataProject project)INTERNAL:
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description booleanequals(Object objectToCompare)INTERNAL:StringgetAccess()INTERNAL: Used for OX mapping.MetadataAnnotatedElementgetAccessibleObject()INTERNAL: Returns the accessible object for this accessor.AccessMethodsMetadatagetAccessMethods()INTERNAL: Used for OX mapping.MetadataAnnotatedElementgetAnnotatedElement()INTERNAL: Return the annotated element for this accessor.StringgetAnnotatedElementName()INTERNAL: Return the annotated element name for this accessor.MetadataAnnotationgetAnnotation(Class<?> annotation)INTERNAL: Return the annotation if it exists.protected abstract MetadataAnnotationgetAnnotation(String annotation)INTERNAL: Return the annotation if it exists.StringgetAttributeName()INTERNAL: Return the attribute name for this accessor.List<ConverterMetadata>getConverters()INTERNAL: Used for OX mapping.protected StringgetDefaultAttributeName()INTERNAL: Return the upper cased attribute name for this accessor.MetadataDescriptorgetDescriptor()INTERNAL: Return the MetadataDescriptor for this accessor.MetadataClassgetDescriptorJavaClass()INTERNAL: Return the java class tied to this class accessor's descriptor.HashPartitioningMetadatagetHashPartitioning()INTERNAL: Used for OX mapping.StringgetIdentifier()INTERNAL: To satisfy the abstract getIdentifier() method from ORMetadata.MetadataClassgetJavaClass()INTERNAL: Return the java class associated with this accessor's descriptor.protected StringgetJavaClassName()INTERNAL: Return the java class that defines this accessor.StringgetName()INTERNAL: Used for OX mapping.List<ObjectTypeConverterMetadata>getObjectTypeConverters()INTERNAL: Used for OX mapping.StringgetPartitioned()INTERNAL: Used for OX mapping.PartitioningMetadatagetPartitioning()INTERNAL: Used for OX mapping.PinnedPartitioningMetadatagetPinnedPartitioning()INTERNAL: Used for OX mapping.List<PropertyMetadata>getProperties()INTERNAL: Used for OX mapping.RangePartitioningMetadatagetRangePartitioning()INTERNAL: Used for OX mapping.protected DatabaseFieldgetReferencedField(String referencedColumnName, MetadataDescriptor referenceDescriptor, String context)INTERNAL: Return the referenced field.protected DatabaseFieldgetReferencedField(String referencedColumnName, MetadataDescriptor referenceDescriptor, String context, boolean isForAggregateCollection)INTERNAL: Return the referenced field.ReplicationPartitioningMetadatagetReplicationPartitioning()INTERNAL: Used for OX mapping.RoundRobinPartitioningMetadatagetRoundRobinPartitioning()INTERNAL: Used for OX mapping.List<SerializedConverterMetadata>getSerializedConverters()INTERNAL: Used for OX mapping.List<StructConverterMetadata>getStructConverters()INTERNAL: Used for OX mapping.List<TypeConverterMetadata>getTypeConverters()INTERNAL: Used for OX mapping.UnionPartitioningMetadatagetUnionPartitioning()INTERNAL: Used for OX mapping.protected StringgetUpperCaseShortJavaClassName()INTERNAL: Return the upper case java class that defines this accessor.protected IntegergetValue(Integer value, Integer defaultValue)INTERNAL: Helper method to return a string value if specified, otherwise returns the default value.protected StringgetValue(String value, String defaultValue)INTERNAL: Helper method to return a string value if specified, otherwise returns the default value.ValuePartitioningMetadatagetValuePartitioning()INTERNAL: Used for OX mapping.booleanhasAccess()INTERNAL:booleanhasAccessMethods()INTERNAL:inthashCode()voidinitAccess()INTERNAL: Called from annotation and xml initialization.voidinitXMLAccessor(MetadataDescriptor descriptor, MetadataProject project)INTERNAL: This method should be subclassed in those methods that need to do extra initialization.voidinitXMLObject(MetadataAccessibleObject accessibleObject, XMLEntityMappings entityMappings)INTERNAL:booleanisAnnotationPresent(Class<? extends Annotation> annotation)INTERNAL: Return true if the annotation exists.abstract booleanisAnnotationPresent(String annotation)INTERNAL: Return the annotation if it exists.abstract booleanisProcessed()Subclasses must handle this flag.voidmerge(ORMetadata metadata)INTERNAL: We currently limit this merging to the ClassAccessor level.abstract voidprocess()INTERNAL: Every accessor knows how to process themselves since they have all the information they need.voidprocessConverters()INTERNAL: Process and add the globally defined converters to the project.protected voidprocessCustomConverters()INTERNAL: Process the XML defined converters and check for a Converter annotation.protected voidprocessObjectTypeConverters()INTERNAL: Process the XML defined object type converters and check for an ObjectTypeConverter annotation.voidprocessPartitioned(String name)Set the policy on the descriptor or mapping.protected voidprocessPartitioning()Process the partitioning policies defined on this element.protected List<PrimaryKeyJoinColumnMetadata>processPrimaryKeyJoinColumns(List<PrimaryKeyJoinColumnMetadata> primaryKeyJoinColumns)INTERNAL: Process the primary key join columms for this accessors annotated element.protected voidprocessSerializedConverters()INTERNAL: Process a the XML defined serialized converters and check for a SerializedConverter annotation.protected voidprocessStructConverters()INTERNAL: Process the XML defined struct converters and check for a StructConverter annotation.protected voidprocessTable(TableMetadata table, String defaultName)INTERNAL: Common table processing for table, secondary table, join table and collection table.protected voidprocessTypeConverters()INTERNAL: Process a the XML defined type converters and check for a TypeConverter annotation.voidsetAccess(String access)INTERNAL: Used for OX mapping.voidsetAccessMethods(AccessMethodsMetadata accessMethods)INTERNAL: Used for OX mapping.voidsetConverters(List<ConverterMetadata> converters)INTERNAL: Used for OX mapping.voidsetDescriptor(MetadataDescriptor descriptor)INTERNAL: Set the metadata descriptor for this accessor.voidsetHashPartitioning(HashPartitioningMetadata hashPartitioning)INTERNAL: Used for OX mapping.voidsetName(String name)INTERNAL: Used for OX mapping.voidsetObjectTypeConverters(List<ObjectTypeConverterMetadata> objectTypeConverters)INTERNAL: Used for OX mapping.voidsetPartitioned(String partitioned)INTERNAL: Used for OX mapping.voidsetPartitioning(PartitioningMetadata partitioning)INTERNAL: Used for OX mapping.voidsetPinnedPartitioning(PinnedPartitioningMetadata pinnedPartitioning)INTERNAL: Used for OX mapping.voidsetProperties(List<PropertyMetadata> properties)INTERNAL: Used for OX mapping.voidsetRangePartitioning(RangePartitioningMetadata rangePartitioning)INTERNAL: Used for OX mapping.voidsetReplicationPartitioning(ReplicationPartitioningMetadata replicationPartitioning)INTERNAL: Used for OX mapping.voidsetRoundRobinPartitioning(RoundRobinPartitioningMetadata roundRobinPartitioning)INTERNAL: Used for OX mapping.voidsetSerializedConverters(List<SerializedConverterMetadata> serializedConverters)INTERNAL: Used for OX mapping.voidsetStructConverters(List<StructConverterMetadata> structConverters)INTERNAL: Used for OX mapping.voidsetTypeConverters(List<TypeConverterMetadata> typeConverters)INTERNAL: Used for OX mapping.voidsetUnionPartitioning(UnionPartitioningMetadata unionPartitioning)INTERNAL: Used for OX mapping.voidsetValuePartitioning(ValuePartitioningMetadata valuePartitioning)INTERNAL: Used for OX mapping.-
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
-
MetadataAccessor
public MetadataAccessor(String xmlElement)
INTERNAL: Used for OX mapping.
-
MetadataAccessor
public MetadataAccessor(MetadataAnnotation annotation, MetadataAccessibleObject accessibleObject, MetadataDescriptor descriptor, MetadataProject project)
INTERNAL:
-
-
Method Detail
-
equals
public boolean equals(Object objectToCompare)
INTERNAL:- Specified by:
equalsin classORMetadata
-
getAccess
public String getAccess()
INTERNAL: Used for OX mapping.
-
getAccessibleObject
public MetadataAnnotatedElement getAccessibleObject()
INTERNAL: Returns the accessible object for this accessor.- Overrides:
getAccessibleObjectin classORMetadata
-
getAccessMethods
public AccessMethodsMetadata getAccessMethods()
INTERNAL: Used for OX mapping.
-
getAnnotatedElement
public MetadataAnnotatedElement getAnnotatedElement()
INTERNAL: Return the annotated element for this accessor.
-
getAnnotatedElementName
public String getAnnotatedElementName()
INTERNAL: Return the annotated element name for this accessor.
-
getAnnotation
public MetadataAnnotation getAnnotation(Class<?> annotation)
INTERNAL: Return the annotation if it exists. This method should only be called for non JPA annotations as loading those annotations classes is ok (and available). JPA annotations should be referenced only by name as to not introduce a compile dependency.
-
getAnnotation
protected abstract MetadataAnnotation getAnnotation(String annotation)
INTERNAL: Return the annotation if it exists.
-
getAttributeName
public String getAttributeName()
INTERNAL: Return the attribute name for this accessor.
-
getConverters
public List<ConverterMetadata> getConverters()
INTERNAL: Used for OX mapping.
-
getDefaultAttributeName
protected String getDefaultAttributeName()
INTERNAL: Return the upper cased attribute name for this accessor. Used when defaulting.
-
getDescriptor
public MetadataDescriptor getDescriptor()
INTERNAL: Return the MetadataDescriptor for this accessor.
-
getDescriptorJavaClass
public MetadataClass getDescriptorJavaClass()
INTERNAL: Return the java class tied to this class accessor's descriptor.
-
getHashPartitioning
public HashPartitioningMetadata getHashPartitioning()
INTERNAL: Used for OX mapping.
-
getIdentifier
public String getIdentifier()
INTERNAL: To satisfy the abstract getIdentifier() method from ORMetadata.
-
getJavaClass
public MetadataClass getJavaClass()
INTERNAL: Return the java class associated with this accessor's descriptor.
-
getJavaClassName
protected String getJavaClassName()
INTERNAL: Return the java class that defines this accessor.
-
getName
public String getName()
INTERNAL: Used for OX mapping.
-
getObjectTypeConverters
public List<ObjectTypeConverterMetadata> getObjectTypeConverters()
INTERNAL: Used for OX mapping.
-
getPartitioned
public String getPartitioned()
INTERNAL: Used for OX mapping.
-
getPartitioning
public PartitioningMetadata getPartitioning()
INTERNAL: Used for OX mapping.
-
getPinnedPartitioning
public PinnedPartitioningMetadata getPinnedPartitioning()
INTERNAL: Used for OX mapping.
-
getProperties
public List<PropertyMetadata> getProperties()
INTERNAL: Used for OX mapping.
-
getRangePartitioning
public RangePartitioningMetadata getRangePartitioning()
INTERNAL: Used for OX mapping.
-
getReferencedField
protected DatabaseField getReferencedField(String referencedColumnName, MetadataDescriptor referenceDescriptor, String context)
INTERNAL: Return the referenced field. If the referencedColumnName is not specified, it will default to the primary key of the referenced table.
-
getReferencedField
protected DatabaseField getReferencedField(String referencedColumnName, MetadataDescriptor referenceDescriptor, String context, boolean isForAggregateCollection)
INTERNAL: Return the referenced field. If the referencedColumnName is not specified, it will default to the primary key of the referenced table.
-
getReplicationPartitioning
public ReplicationPartitioningMetadata getReplicationPartitioning()
INTERNAL: Used for OX mapping.
-
getRoundRobinPartitioning
public RoundRobinPartitioningMetadata getRoundRobinPartitioning()
INTERNAL: Used for OX mapping.
-
getStructConverters
public List<StructConverterMetadata> getStructConverters()
INTERNAL: Used for OX mapping.
-
getTypeConverters
public List<TypeConverterMetadata> getTypeConverters()
INTERNAL: Used for OX mapping.
-
getSerializedConverters
public List<SerializedConverterMetadata> getSerializedConverters()
INTERNAL: Used for OX mapping.
-
getUnionPartitioning
public UnionPartitioningMetadata getUnionPartitioning()
INTERNAL: Used for OX mapping.
-
getUpperCaseShortJavaClassName
protected String getUpperCaseShortJavaClassName()
INTERNAL: Return the upper case java class that defines this accessor.
-
getValue
protected Integer getValue(Integer value, Integer defaultValue)
INTERNAL: Helper method to return a string value if specified, otherwise returns the default value.
-
getValue
protected String getValue(String value, String defaultValue)
INTERNAL: Helper method to return a string value if specified, otherwise returns the default value.
-
getValuePartitioning
public ValuePartitioningMetadata getValuePartitioning()
INTERNAL: Used for OX mapping.
-
hasAccess
public boolean hasAccess()
INTERNAL:
-
hasAccessMethods
public boolean hasAccessMethods()
INTERNAL:
-
initAccess
public void initAccess()
INTERNAL: Called from annotation and xml initialization.
-
initXMLAccessor
public void initXMLAccessor(MetadataDescriptor descriptor, MetadataProject project)
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:
initXMLObjectin classORMetadata
-
isAnnotationPresent
public boolean isAnnotationPresent(Class<? extends Annotation> annotation)
INTERNAL: Return true if the annotation exists. This method should only be called for non native annotations (i.e. JPA) as loading native annotations classes is ok since we know they are available from the jar. JPA annotations should be referenced only by name as to not introduce a compile dependency.
-
isAnnotationPresent
public abstract boolean isAnnotationPresent(String annotation)
INTERNAL: Return the annotation if it exists.
-
isProcessed
public abstract boolean isProcessed()
Subclasses must handle this flag.
-
merge
public void merge(ORMetadata metadata)
INTERNAL: We currently limit this merging to the ClassAccessor level.- Overrides:
mergein classORMetadata
-
process
public abstract void process()
INTERNAL: Every accessor knows how to process themselves since they have all the information they need.
-
processConverters
public void processConverters()
INTERNAL: Process and add the globally defined converters to the project.
-
processCustomConverters
protected void processCustomConverters()
INTERNAL: Process the XML defined converters and check for a Converter annotation.
-
processObjectTypeConverters
protected void processObjectTypeConverters()
INTERNAL: Process the XML defined object type converters and check for an ObjectTypeConverter annotation.
-
processPartitioned
public void processPartitioned(String name)
Set the policy on the descriptor or mapping.
-
processPartitioning
protected void processPartitioning()
Process the partitioning policies defined on this element.
-
processPrimaryKeyJoinColumns
protected List<PrimaryKeyJoinColumnMetadata> processPrimaryKeyJoinColumns(List<PrimaryKeyJoinColumnMetadata> primaryKeyJoinColumns)
INTERNAL: Process the primary key join columms for this accessors annotated element.
-
processStructConverters
protected void processStructConverters()
INTERNAL: Process the XML defined struct converters and check for a StructConverter annotation.
-
processTable
protected void processTable(TableMetadata table, String defaultName)
INTERNAL: Common table processing for table, secondary table, join table and collection table.
-
processTypeConverters
protected void processTypeConverters()
INTERNAL: Process a the XML defined type converters and check for a TypeConverter annotation.
-
processSerializedConverters
protected void processSerializedConverters()
INTERNAL: Process a the XML defined serialized converters and check for a SerializedConverter annotation.
-
setAccess
public void setAccess(String access)
INTERNAL: Used for OX mapping.
-
setAccessMethods
public void setAccessMethods(AccessMethodsMetadata accessMethods)
INTERNAL: Used for OX mapping.
-
setConverters
public void setConverters(List<ConverterMetadata> converters)
INTERNAL: Used for OX mapping.
-
setDescriptor
public void setDescriptor(MetadataDescriptor descriptor)
INTERNAL: Set the metadata descriptor for this accessor. When setting the descriptor on entities, the owning descriptor is set to this descriptor.
-
setHashPartitioning
public void setHashPartitioning(HashPartitioningMetadata hashPartitioning)
INTERNAL: Used for OX mapping.
-
setName
public void setName(String name)
INTERNAL: Used for OX mapping.
-
setObjectTypeConverters
public void setObjectTypeConverters(List<ObjectTypeConverterMetadata> objectTypeConverters)
INTERNAL: Used for OX mapping.
-
setPartitioned
public void setPartitioned(String partitioned)
INTERNAL: Used for OX mapping.
-
setPartitioning
public void setPartitioning(PartitioningMetadata partitioning)
INTERNAL: Used for OX mapping.
-
setPinnedPartitioning
public void setPinnedPartitioning(PinnedPartitioningMetadata pinnedPartitioning)
INTERNAL: Used for OX mapping.
-
setProperties
public void setProperties(List<PropertyMetadata> properties)
INTERNAL: Used for OX mapping.
-
setRangePartitioning
public void setRangePartitioning(RangePartitioningMetadata rangePartitioning)
INTERNAL: Used for OX mapping.
-
setReplicationPartitioning
public void setReplicationPartitioning(ReplicationPartitioningMetadata replicationPartitioning)
INTERNAL: Used for OX mapping.
-
setRoundRobinPartitioning
public void setRoundRobinPartitioning(RoundRobinPartitioningMetadata roundRobinPartitioning)
INTERNAL: Used for OX mapping.
-
setStructConverters
public void setStructConverters(List<StructConverterMetadata> structConverters)
INTERNAL: Used for OX mapping.
-
setTypeConverters
public void setTypeConverters(List<TypeConverterMetadata> typeConverters)
INTERNAL: Used for OX mapping.
-
setSerializedConverters
public void setSerializedConverters(List<SerializedConverterMetadata> serializedConverters)
INTERNAL: Used for OX mapping.
-
setUnionPartitioning
public void setUnionPartitioning(UnionPartitioningMetadata unionPartitioning)
INTERNAL: Used for OX mapping.
-
setValuePartitioning
public void setValuePartitioning(ValuePartitioningMetadata valuePartitioning)
INTERNAL: Used for OX mapping.
-
-