Class ORMetadata
- java.lang.Object
-
- org.eclipse.persistence.internal.jpa.metadata.ORMetadata
-
- Direct Known Subclasses:
AbstractPartitioningMetadata,AccessMethodsMetadata,AdditionalCriteriaMetadata,BatchFetchMetadata,CacheIndexMetadata,CacheInterceptorMetadata,CacheMetadata,CascadeMetadata,ChangeTrackingMetadata,ColumnResultMetadata,ComplexTypeMetadata,ConstructorResultMetadata,ConversionValueMetadata,ConverterAccessor,ConvertMetadata,CopyPolicyMetadata,DiscriminatorClassMetadata,EntityListenerMetadata,EntityResultMetadata,FetchAttributeMetadata,FetchGroupMetadata,FieldResultMetadata,ForeignKeyMetadata,GeneratedValueMetadata,IndexMetadata,InheritanceMetadata,MapKeyMetadata,MetadataAccessor,MetadataColumn,MetadataConverter,MultitenantMetadata,NamedAttributeNodeMetadata,NamedEntityGraphMetadata,NamedQueryMetadata,NamedSubgraphMetadata,NoSqlMetadata,OptimisticLockingMetadata,OrderByMetadata,OverrideMetadata,PLSQLParameterMetadata,PrimaryKeyMetadata,PropertyMetadata,QueryHintMetadata,QueryRedirectorsMetadata,RangePartitionMetadata,ReadTransformerMetadata,ReturnInsertMetadata,SequenceGeneratorMetadata,SerializedObjectPolicyMetadata,SQLResultSetMappingMetadata,StoredProcedureParameterMetadata,StructMetadata,TableMetadata,TenantTableDiscriminatorMetadata,TimeOfDayMetadata,UniqueConstraintMetadata,UuidGeneratorMetadata,ValuePartitionMetadata,XMLAttributes,XMLEntityMappings,XMLPersistenceUnitDefaults,XMLPersistenceUnitMetadata
public abstract class ORMetadata extends java.lang.ObjectINTERNAL: Abstract/common level for JPA Object/Relational metadata. This class handles the merging and overriding details for those metadata objects who care about it. For consistency, and ease of future work, all metadata objects added should extend this class even though they may not currently have a need for merging and overriding. Subclasses that care about merging need to concern themselves with the following methods: - getIdentifier() used to compare two named objects. - equals() used to compare if two objects have similar metadata. - setLocation() must be set on the accessible object. From annotations this is handled in the constructor. For XML objects you need to ensure their init method or processing method sets the location (that is, a mapping file) where the element was found.- Since:
- EclipseLink 1.0
- Author:
- Guy Pelletier
-
-
Field Summary
Fields Modifier and Type Field Description protected MetadataProjectm_project
-
Constructor Summary
Constructors Modifier Constructor Description protectedORMetadata()INTERNAL: Used for defaulting case.ORMetadata(java.lang.String xmlElement)INTERNAL: Used for OX loading.protectedORMetadata(MetadataAccessibleObject accessibleObject, MetadataProject project, java.lang.Object location)INTERNAL: Used for defaulting.ORMetadata(MetadataAnnotation annotation, MetadataAccessor accessor)INTERNAL: Used for annotation loading of metadata objects.ORMetadata(MetadataAnnotation annotation, MetadataAccessibleObject accessibleObject, MetadataProject project)INTERNAL: Used for annotation loading of class and mapping accessors.ORMetadata(ORMetadata orm)INTERNAL: Used for annotation loading and switching from one metadata object to a more specific one.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract booleanequals(java.lang.Object objectToCompare)INTERNAL: For merging and overriding to work properly, all ORMetadata must be able to compare themselves for metadata equality.protected MetadataAccessibleObjectgetAccessibleObject()INTERNAL: Returns the accessible object for this accessor.java.lang.StringgetAccessibleObjectName()INTERNAL: Returns the name of the accessible object.MetadataAnnotationgetAnnotation()INTERNAL: This is a value is that is used when logging messages for overriding.protected java.lang.StringgetBoxedType(java.lang.String type)INTERNAL: Quick lookup of a primitive boxed type.protected org.eclipse.persistence.internal.helper.DatabaseTypegetDatabaseTypeEnum(java.lang.String type)Return the DataType enum constant for the String type name.XMLEntityMappingsgetEntityMappings()INTERNAL:protected java.lang.StringgetFullyQualifiedClassName(java.lang.String className)INTERNAL: Return the fully qualified className using the package (if any) setting from XML.protected java.lang.StringgetIdentifier()INTERNAL: Sub classes that can uniquely be identified must override this method to allow the overriding and merging to uniquely identify objects.protected java.lang.ClassgetJavaClass(MetadataClass metadataClass)INTERNAL: Return the Java class for the metadata class using the metadata loader.java.lang.StringgetJavaClassName(MetadataClass metadataClass)INTERNAL: Return the Java class name for the metadata class.java.lang.ClassLoadergetLoader()INTERNAL: This method will return the current loader from the metadata factory used to created this ORMetadata.java.lang.ObjectgetLocation()INTERNAL:MetadataLoggergetLogger()INTERNAL: Return the metadata logger.MetadataClassgetMetadataClass(java.lang.Class javaClass)INTERNAL: Return the MetadataClass for the class.MetadataClassgetMetadataClass(java.lang.String className)INTERNAL: Return the MetadataClass for the class name.MetadataClassgetMetadataClass(java.lang.String className, boolean isLazy)INTERNAL: Return the MetadataClass for the class name.MetadataFactorygetMetadataFactory()INTERNAL:protected java.lang.StringgetName(java.lang.String name, java.lang.String defaultName, java.lang.String context)INTERNAL: Helper method to return a field name from a candidate field name and a default field name.protected java.lang.ClassgetPrimitiveClassForName(java.lang.String className)INTERNAL:MetadataProjectgetProject()INTERNAL: Return the MetadataProject.protected java.lang.StringgetText()INTERNAL: Any ORMetadata that supported mixed types, that is, text or other metadata should override this method.protected java.lang.StringgetXMLElement()INTERNAL: This is a value is that is used when logging messages for overriding.protected booleanhasIdentifier()INTERNAL:protected booleanhasText()INTERNAL: Any ORMetadata that supported mixed types, that is, text or other metadata should override this method.protected MetadataClassinitXMLClassName(java.lang.String className)INTERNAL: This method should only be called on those objects that were loaded from XML and that need to initialize a class name.voidinitXMLObject(MetadataAccessibleObject accessibleObject, XMLEntityMappings entityMappings)INTERNAL: Any subclass that cares to do any more initialization (e.g.protected voidinitXMLObject(ORMetadata metadata, MetadataAccessibleObject accessibleObject)INTERNAL:protected voidinitXMLObjects(java.util.List metadatas, MetadataAccessibleObject accessibleObject)INTERNAL: It is assumed this is a list of ORMetadataprotected java.lang.StringinitXMLTextObject(java.util.List metadatas)INTERNAL: This is to support legacy orm instance docs.booleanloadedFromAnnotation()INTERNAL: Note: That annotations can default so the annotation may be null.booleanloadedFromEclipseLinkXML()INTERNAL:booleanloadedFromXML()INTERNAL:protected voidmerge(ORMetadata metadata)INTERNAL: Subclasses that care to handle deeper merges should extend this method.protected java.util.ListmergeORObjectLists(java.util.List list1, java.util.List list2)INTERNAL: Convenience method to merge two lists of metadata objects.protected ORMetadatamergeORObjects(ORMetadata obj1, ORMetadata obj2)INTERNAL: Convenience method to merge two objects that were loaded from XML.protected java.lang.ObjectmergeSimpleObjects(java.lang.Object obj1, java.lang.Object obj2, ORMetadata otherMetadata, java.lang.String xmlElement)INTERNAL: Convenience method to merge two objects that were loaded from XML.protected EntityAccessorreloadEntity(EntityAccessor entity, MetadataDescriptor descriptor)INTERNAL: This method should be called to reload an entity (that was either loaded from XML or an annotation) as a way of cloning it.protected MappedSuperclassAccessorreloadMappedSuperclass(MappedSuperclassAccessor mappedSuperclass, MetadataDescriptor descriptor)INTERNAL: This method should be called to reload a mapped superclass (that was either loaded from XML or an annotation) as a way of cloning it.voidsetAccessibleObject(MetadataAccessibleObject accessibleObject)INTERNAL: Set the accessible object for this accessor.voidsetEntityMappings(XMLEntityMappings entityMappings)INTERNAL: Set the entity mappings (mapping file) for this OR object.protected voidsetFieldName(org.eclipse.persistence.internal.helper.DatabaseField field, java.lang.String name)INTERNAL: All field names should be set through this method to ensure delimited identifiers and upper casing defaults are set.protected voidsetFieldName(org.eclipse.persistence.internal.helper.DatabaseField field, java.lang.String defaultName, java.lang.String context)INTERNAL: Go through this method if you can default a name.voidsetProject(MetadataProject project)INTERNAL: Set the metadata project.booleanshouldOverride(ORMetadata existing)INTERNAL: Method to determine if this ORMetadata should override another.protected booleanvaluesMatch(java.lang.Object value1, java.lang.Object value2)INTERNAL:protected booleanvaluesMatch(java.util.List<java.lang.Object> list1, java.util.List<java.lang.Object> list2)INTERNAL: Two lists are the same if they are the same size and their ordered elements are the same.
-
-
-
Field Detail
-
m_project
protected MetadataProject m_project
-
-
Constructor Detail
-
ORMetadata
protected ORMetadata()
INTERNAL: Used for defaulting case.
-
ORMetadata
public ORMetadata(java.lang.String xmlElement)
INTERNAL: Used for OX loading.
-
ORMetadata
protected ORMetadata(MetadataAccessibleObject accessibleObject, MetadataProject project, java.lang.Object location)
INTERNAL: Used for defaulting. At minimum, all metadata should have this information available to them at process time (to ensure no errors during processing). Depending on the metadata processing needs you can get away with not having them set, however, any dependencies on the loader, metadata logger or the metadata project etc. will require these.
-
ORMetadata
public ORMetadata(MetadataAnnotation annotation, MetadataAccessor accessor)
INTERNAL: Used for annotation loading of metadata objects.
-
ORMetadata
public ORMetadata(MetadataAnnotation annotation, MetadataAccessibleObject accessibleObject, MetadataProject project)
INTERNAL: Used for annotation loading of class and mapping accessors.
-
ORMetadata
public ORMetadata(ORMetadata orm)
INTERNAL: Used for annotation loading and switching from one metadata object to a more specific one.
-
-
Method Detail
-
equals
public abstract boolean equals(java.lang.Object objectToCompare)
INTERNAL: For merging and overriding to work properly, all ORMetadata must be able to compare themselves for metadata equality. equals plays a big role in the shouldOverride() method from this class.- Overrides:
equalsin classjava.lang.Object
-
getAccessibleObject
protected MetadataAccessibleObject getAccessibleObject()
INTERNAL: Returns the accessible object for this accessor.
-
getAccessibleObjectName
public java.lang.String getAccessibleObjectName()
INTERNAL: Returns the name of the accessible object. If it is a field, it will return the field name. For a method it will return the method name.
-
getAnnotation
public MetadataAnnotation getAnnotation()
INTERNAL: This is a value is that is used when logging messages for overriding.
-
getBoxedType
protected java.lang.String getBoxedType(java.lang.String type)
INTERNAL: Quick lookup of a primitive boxed type.
-
getLoader
public java.lang.ClassLoader getLoader()
INTERNAL: This method will return the current loader from the metadata factory used to created this ORMetadata.
-
getDatabaseTypeEnum
protected org.eclipse.persistence.internal.helper.DatabaseType getDatabaseTypeEnum(java.lang.String type)
Return the DataType enum constant for the String type name. If not a type defined by the enums, then return a record type.
-
getEntityMappings
public XMLEntityMappings getEntityMappings()
INTERNAL:
-
getFullyQualifiedClassName
protected java.lang.String getFullyQualifiedClassName(java.lang.String className)
INTERNAL: Return the fully qualified className using the package (if any) setting from XML.
-
getIdentifier
protected java.lang.String getIdentifier()
INTERNAL: Sub classes that can uniquely be identified must override this method to allow the overriding and merging to uniquely identify objects. It will also be used when logging messages, that is, to provide a more detailed message.
-
getJavaClass
protected java.lang.Class getJavaClass(MetadataClass metadataClass)
INTERNAL: Return the Java class for the metadata class using the metadata loader. Callers to this method should only do so when the application loader (from deploy) is available. This method should not be called with the temp loader, see getJavaClassName instead which will provide a valid string class name that can be initialized at runtime instead.
-
getJavaClassName
public java.lang.String getJavaClassName(MetadataClass metadataClass)
INTERNAL: Return the Java class name for the metadata class. This is the class name name metadata processing should set on descriptors and mappings to be initialized during the convertClassNamesToClasses call at runtime.
-
getLocation
public java.lang.Object getLocation()
INTERNAL:
-
getLogger
public MetadataLogger getLogger()
INTERNAL: Return the metadata logger.
-
getMetadataClass
public MetadataClass getMetadataClass(java.lang.Class javaClass)
INTERNAL: Return the MetadataClass for the class.
-
getMetadataClass
public MetadataClass getMetadataClass(java.lang.String className)
INTERNAL: Return the MetadataClass for the class name.
-
getMetadataClass
public MetadataClass getMetadataClass(java.lang.String className, boolean isLazy)
INTERNAL: Return the MetadataClass for the class name.
-
getMetadataFactory
public MetadataFactory getMetadataFactory()
INTERNAL:
-
getName
protected java.lang.String getName(java.lang.String name, java.lang.String defaultName, java.lang.String context)INTERNAL: Helper method to return a field name from a candidate field name and a default field name. Requires the context from where this method is called to output the correct logging message when defaulting the field name. In some cases, both the name and defaultName could be "" or null, therefore, don't log a message and return name.
-
getPrimitiveClassForName
protected java.lang.Class getPrimitiveClassForName(java.lang.String className)
INTERNAL:
-
getProject
public MetadataProject getProject()
INTERNAL: Return the MetadataProject.
-
getText
protected java.lang.String getText()
INTERNAL: Any ORMetadata that supported mixed types, that is, text or other metadata should override this method.
-
getXMLElement
protected java.lang.String getXMLElement()
INTERNAL: This is a value is that is used when logging messages for overriding.
-
hasIdentifier
protected boolean hasIdentifier()
INTERNAL:
-
hasText
protected boolean hasText()
INTERNAL: Any ORMetadata that supported mixed types, that is, text or other metadata should override this method.
-
initXMLClassName
protected MetadataClass initXMLClassName(java.lang.String className)
INTERNAL: This method should only be called on those objects that were loaded from XML and that need to initialize a class name. The assumption here is that an entity mappings object will be available.
-
initXMLObject
public void initXMLObject(MetadataAccessibleObject accessibleObject, XMLEntityMappings entityMappings)
INTERNAL: Any subclass that cares to do any more initialization (e.g. initialize a class) should override this method.
-
initXMLObject
protected void initXMLObject(ORMetadata metadata, MetadataAccessibleObject accessibleObject)
INTERNAL:
-
initXMLObjects
protected void initXMLObjects(java.util.List metadatas, MetadataAccessibleObject accessibleObject)INTERNAL: It is assumed this is a list of ORMetadata
-
initXMLTextObject
protected java.lang.String initXMLTextObject(java.util.List metadatas)
INTERNAL: This is to support legacy orm instance docs. In some cases, previous simple text elements may have been changed to a list of ORMetadata through spec churn. (e.g.). Method helps support backwards compatibility. If the text object is initialized the metadata list is set to null to ease further processing (logging, warnings, overrides etc.)
-
loadedFromAnnotation
public boolean loadedFromAnnotation()
INTERNAL: Note: That annotations can default so the annotation may be null.
-
loadedFromEclipseLinkXML
public boolean loadedFromEclipseLinkXML()
INTERNAL:
-
loadedFromXML
public boolean loadedFromXML()
INTERNAL:
-
merge
protected void merge(ORMetadata metadata)
INTERNAL: Subclasses that care to handle deeper merges should extend this method.
-
mergeORObjectLists
protected java.util.List mergeORObjectLists(java.util.List list1, java.util.List list2)INTERNAL: Convenience method to merge two lists of metadata objects. This does not check for duplicates or any overrides at this time. Just appends all items from list2 to list1.
-
mergeORObjects
protected ORMetadata mergeORObjects(ORMetadata obj1, ORMetadata obj2)
INTERNAL: Convenience method to merge two objects that were loaded from XML. The merge is complete. If value2 is specified it will override value1, otherwise, value1 does not change.
-
mergeSimpleObjects
protected java.lang.Object mergeSimpleObjects(java.lang.Object obj1, java.lang.Object obj2, ORMetadata otherMetadata, java.lang.String xmlElement)INTERNAL: Convenience method to merge two objects that were loaded from XML. The merge is complete. If value2 is specified it will override value1, otherwise, value1 does not.
-
reloadEntity
protected EntityAccessor reloadEntity(EntityAccessor entity, MetadataDescriptor descriptor)
INTERNAL: This method should be called to reload an entity (that was either loaded from XML or an annotation) as a way of cloning it. This is needed when we process TABLE_PER_CLASS inheritance. We must process the parent classes for every subclasses descriptor. The processing is similar to that of processing a mapped superclass, in that we process the parents with the subclasses context (that is, the descriptor we are given).
-
reloadMappedSuperclass
protected MappedSuperclassAccessor reloadMappedSuperclass(MappedSuperclassAccessor mappedSuperclass, MetadataDescriptor descriptor)
INTERNAL: This method should be called to reload a mapped superclass (that was either loaded from XML or an annotation) as a way of cloning it. This is needed when processing TABLE_PER_CLASS inheritance and when building individual entity accessor's mapped superclass list.
-
setAccessibleObject
public void setAccessibleObject(MetadataAccessibleObject accessibleObject)
INTERNAL: Set the accessible object for this accessor.
-
setEntityMappings
public void setEntityMappings(XMLEntityMappings entityMappings)
INTERNAL: Set the entity mappings (mapping file) for this OR object.
-
setFieldName
protected void setFieldName(org.eclipse.persistence.internal.helper.DatabaseField field, java.lang.String name)INTERNAL: All field names should be set through this method to ensure delimited identifiers and upper casing defaults are set.
-
setFieldName
protected void setFieldName(org.eclipse.persistence.internal.helper.DatabaseField field, java.lang.String defaultName, java.lang.String context)INTERNAL: Go through this method if you can default a name. Provide the defaulting context to log to the correct context message to the user.
-
setProject
public void setProject(MetadataProject project)
INTERNAL: Set the metadata project.
-
shouldOverride
public boolean shouldOverride(ORMetadata existing)
INTERNAL: Method to determine if this ORMetadata should override another. Assumes all ORMetadata that call this method have correctly implemented their equals method.
-
valuesMatch
protected boolean valuesMatch(java.util.List<java.lang.Object> list1, java.util.List<java.lang.Object> list2)INTERNAL: Two lists are the same if they are the same size and their ordered elements are the same.
-
valuesMatch
protected boolean valuesMatch(java.lang.Object value1, java.lang.Object value2)INTERNAL:
-
-