Module org.eclipse.persistence.jpa
Class MetadataAnnotatedElement
- java.lang.Object
-
- org.eclipse.persistence.internal.jpa.metadata.accessors.objects.MetadataAccessibleObject
-
- org.eclipse.persistence.internal.jpa.metadata.accessors.objects.MetadataAnnotatedElement
-
- Direct Known Subclasses:
MetadataClass,MetadataField,MetadataMethod
public class MetadataAnnotatedElement extends MetadataAccessibleObject
INTERNAL: Parent object that is used to hold onto a valid JPA decorated method, field or class.- Since:
- EclipseLink 1.0
- Author:
- Guy Pelletier
-
-
Field Summary
Fields Modifier and Type Field Description static StringDEFAULT_RAW_CLASS-
Fields inherited from class org.eclipse.persistence.internal.jpa.metadata.accessors.objects.MetadataAccessibleObject
m_factory
-
-
Constructor Summary
Constructors Constructor Description MetadataAnnotatedElement(MetadataFactory factory)INTERNAL:
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddAnnotation(MetadataAnnotation annotation)INTERNAL:voidaddGenericType(String genericType)INTERNAL:voidaddMetaAnnotation(MetadataAnnotation annotation)INTERNAL:booleanareAnnotationsCompatibleWithTransient(ClassAccessor classAccessor)INTERNAL: Return true if this accessible object has 2 or more declared persistence annotations.booleanequals(Object object)INTERNAL:MetadataAnnotationgetAnnotation(Class<?> annotation)INTERNAL: Return the annotated element for this accessor.MetadataAnnotationgetAnnotation(String annotation)INTERNAL: Return the annotated element for this accessor.protected MetadataAnnotationgetAnnotation(String annotation, Set<String> names)INTERNAL: Return the annotated element for this accessor.MetadataAnnotationgetAnnotation(String annotationClassName, ClassAccessor classAccessor)INTERNAL: Return the annotated element for this accessor.Map<String,MetadataAnnotation>getAnnotations()INTERNAL: Return the annotations of this accessible object.StringgetAttributeName()INTERNAL:protected intgetDeclaredAnnotationsCount(ClassAccessor classAccessor)INTERNAL:List<String>getGenericType()INTERNAL:MetadataClassgetMapKeyClass(MetadataDescriptor descriptor)INTERNAL: This should only be called for accessor's of type Map.intgetModifiers()INTERNAL:StringgetName()INTERNAL:ObjectgetPrimitiveType()INTERNAL: If this annotated element was built from java model elements and is a primitive type, this primitive type will be set.MetadataClassgetRawClass(MetadataDescriptor descriptor)INTERNAL: Return the raw class for this accessible object.MetadataClassgetRawClassWithGenerics(MetadataDescriptor descriptor)INTERNAL: Return the complete raw class with generics for this accessible object.MetadataClassgetReferenceClassFromGeneric(MetadataDescriptor descriptor)INTERNAL: Return the reference class from the generic specification on this accessible object.StringgetType()INTERNAL:booleanhasDeclaredAnnotations(ClassAccessor classAccessor)INTERNAL: Return true if this accessible object has 1 or more declared persistence annotations.inthashCode()INTERNAL:booleanisAnnotationNotPresent(Class<?> annotation, ClassAccessor accessor)INTERNAL: Indicates whether the specified annotation is actually not present on this accessible object.booleanisAnnotationNotPresent(String annotation, ClassAccessor accessor)INTERNAL: Indicates whether the specified annotation is actually not present on this accessible object.booleanisAnnotationPresent(Class<?> annotationClass, ClassAccessor accessor)INTERNAL: Indicates whether the specified annotation is present on java class for the given descriptor metadata.booleanisAnnotationPresent(String annotation)INTERNAL: Indicates whether the specified annotation is present on this accessible object.booleanisAnnotationPresent(String annotationName, ClassAccessor accessor)INTERNAL: Indicates whether the specified annotation is present on java class for the given descriptor metadata.booleanisArray(ClassAccessor classAccessor)INTERNAL: Return true if this field accessor represents an array relationship.booleanisBasic(ClassAccessor classAccessor)INTERNAL: Return true if this accessor represents a basic mapping.booleanisBasicCollection(ClassAccessor classAccessor)INTERNAL: Return true if this accessor represents a basic collection mapping.booleanisBasicMap(ClassAccessor classAccessor)INTERNAL: Return true if this accessor represents a basic collection mapping.booleanisDerivedId(ClassAccessor classAccessor)INTERNAL: Return true if this accessor represents an id mapping.booleanisDerivedIdClass(ClassAccessor classAccessor)INTERNAL: Return true if this accessor represents an id mapping.booleanisElementCollection(ClassAccessor classAccessor)INTERNAL: Return true if this accessor represents an element collection mapping.booleanisEmbedded(ClassAccessor classAccessor)INTERNAL: Return true if this accessor represents an aggregate mapping.booleanisEmbeddedId(ClassAccessor classAccessor)INTERNAL: Return true if this accessor represents an aggregate id mapping.booleanisGenericCollectionType()INTERNAL: Method to return whether a collection type is a generic.booleanisGenericType()INTERNAL: Method to return whether a type is a generic.booleanisId(ClassAccessor classAccessor)INTERNAL: Return true if this accessor represents an id mapping.booleanisManyToMany(ClassAccessor classAccessor)INTERNAL: Return true if this field accessor represents a m-m relationship.booleanisManyToOne(ClassAccessor classAccessor)INTERNAL: Return true if this accessor represents a m-1 relationship.booleanisOneToMany(ClassAccessor classAccessor)INTERNAL: Return true if this accessor represents a 1-m relationship.booleanisOneToOne(ClassAccessor classAccessor)INTERNAL: Return true if this accessor represents a 1-1 relationship.booleanisStructure(ClassAccessor classAccessor)INTERNAL: Return true if this field accessor represents a structure relationship.booleanisSupportedCollectionClass(MetadataClass metadataClass)INTERNAL: Method to return whether the given class is a supported collection class.booleanisSupportedMapClass(MetadataClass metadataClass)INTERNAL: Method to return whether the given class is a supported map class.booleanisSupportedToManyCollectionClass(MetadataClass metadataClass)INTERNAL: Method to return whether the given class is a supported to many collection class.booleanisTransformation(ClassAccessor classAccessor)INTERNAL: Return true if this accessor represents an transformation mapping.protected booleanisValidPersistenceElement(boolean mustBeExplicit, String explicitType, ClassAccessor classAccessor)INTERNAL: When processing the inverse accessors to an explicit access setting, their must be an Access(FIELD) or Access(PROPERTY) present for the element to be processed.protected booleanisValidPersistenceElement(int modifiers)INTERNAL: Return true if the modifiers are not transient, static or abstract.booleanisVariableOneToOne(ClassAccessor classAccessor)INTERNAL: Return true if this accessor represents a variable 1-1 relationship.booleanisVersion(ClassAccessor classAccessor)INTERNAL: Return true if this accessor represents a version mapping.voidsetAnnotations(Map<String,MetadataAnnotation> annotations)INTERNAL: Set the annotations of this accessible object.voidsetAttributeName(String attributeName)INTERNAL:voidsetGenericType(List<String> genericType)INTERNAL:voidsetModifiers(int modifiers)INTERNAL:voidsetName(String name)INTERNAL:voidsetPrimitiveType(Object primitiveType)INTERNAL: If this annotated element was built from java model elements and is a primitive type this method will be called.voidsetType(String type)INTERNAL:StringtoString()INTERNAL:-
Methods inherited from class org.eclipse.persistence.internal.jpa.metadata.accessors.objects.MetadataAccessibleObject
getLogger, getMetadataClass, getMetadataFactory, setMetadataFactory
-
-
-
-
Field Detail
-
DEFAULT_RAW_CLASS
public static final String DEFAULT_RAW_CLASS
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
MetadataAnnotatedElement
public MetadataAnnotatedElement(MetadataFactory factory)
INTERNAL:
-
-
Method Detail
-
addAnnotation
public void addAnnotation(MetadataAnnotation annotation)
INTERNAL:
-
addMetaAnnotation
public void addMetaAnnotation(MetadataAnnotation annotation)
INTERNAL:
-
addGenericType
public void addGenericType(String genericType)
INTERNAL:
-
getAnnotation
public MetadataAnnotation getAnnotation(Class<?> annotation)
INTERNAL: Return the annotated element for this accessor. Note: This method does not check against a metadata complete.
-
getAnnotation
public MetadataAnnotation getAnnotation(String annotation)
INTERNAL: Return the annotated element for this accessor. Note: This method does not check against a meta-data complete.- Parameters:
annotation- annotation name
-
getAnnotation
protected final MetadataAnnotation getAnnotation(String annotation, Set<String> names)
INTERNAL: Return the annotated element for this accessor. Note: This method does not check against a meta-data complete.- Parameters:
annotation- annotation namenames- meta-annotations names cycle detection set, shall not benull
-
getAnnotation
public MetadataAnnotation getAnnotation(String annotationClassName, ClassAccessor classAccessor)
INTERNAL: Return the annotated element for this accessor.
-
getAnnotations
public Map<String,MetadataAnnotation> getAnnotations()
INTERNAL: Return the annotations of this accessible object.- Returns:
- annotations defined for the element, keyed by annotation name.
Never returns
null.
-
getAttributeName
public String getAttributeName()
INTERNAL:- Specified by:
getAttributeNamein classMetadataAccessibleObject
-
getDeclaredAnnotationsCount
protected int getDeclaredAnnotationsCount(ClassAccessor classAccessor)
INTERNAL:
-
getMapKeyClass
public MetadataClass getMapKeyClass(MetadataDescriptor descriptor)
INTERNAL: This should only be called for accessor's of type Map. It will return the map key type if generics are used, null otherwise.
-
getModifiers
public int getModifiers()
INTERNAL:
-
getName
public String getName()
INTERNAL:- Specified by:
getNamein classMetadataAccessibleObject
-
getPrimitiveType
public Object getPrimitiveType()
INTERNAL: If this annotated element was built from java model elements and is a primitive type, this primitive type will be set.
-
getRawClass
public MetadataClass getRawClass(MetadataDescriptor descriptor)
INTERNAL: Return the raw class for this accessible object. E.g. For an accessible object with a type of java.util.Collection<Employee>, this method will return java.util.Collection.
-
getRawClassWithGenerics
public MetadataClass getRawClassWithGenerics(MetadataDescriptor descriptor)
INTERNAL: Return the complete raw class with generics for this accessible object. E.g. For an accessible object with a type of java.util.Collection<Employee>, this method will return java.util.CollectionEmployee. Note, the generics are appended to the name of the class.
-
getReferenceClassFromGeneric
public MetadataClass getReferenceClassFromGeneric(MetadataDescriptor descriptor)
INTERNAL: Return the reference class from the generic specification on this accessible object. Here is what you will get back from this method given the following scenarios: 1 - public Collection<String> getTasks() => String.class 2 - public Map<String, Integer> getTasks() => Integer.class 3 - public Employee getEmployee() => null 4 - public Collection getTasks() => null 5 - public Map getTasks() => null 6 - public Collection<byte[]> getAudio() => byte[].class 7 - public Map<X,Y> on a MappedSuperclass where Y is defined in the Entity superclass<T> => Void.class (in all bug 266912 cases)
-
getType
public String getType()
INTERNAL:
-
hasDeclaredAnnotations
public boolean hasDeclaredAnnotations(ClassAccessor classAccessor)
INTERNAL: Return true if this accessible object has 1 or more declared persistence annotations.
-
areAnnotationsCompatibleWithTransient
public boolean areAnnotationsCompatibleWithTransient(ClassAccessor classAccessor)
INTERNAL: Return true if this accessible object has 2 or more declared persistence annotations.
-
isAnnotationNotPresent
public boolean isAnnotationNotPresent(Class<?> annotation, ClassAccessor accessor)
INTERNAL: Indicates whether the specified annotation is actually not present on this accessible object. Used for defaulting. Need this check since the isAnnotationPresent calls can return a false when true because of the meta-data complete feature.
-
isAnnotationNotPresent
public boolean isAnnotationNotPresent(String annotation, ClassAccessor accessor)
INTERNAL: Indicates whether the specified annotation is actually not present on this accessible object. Used for defaulting. Need this check since the isAnnotationPresent calls can return a false when true because of the meta-data complete feature.
-
isAnnotationPresent
public boolean isAnnotationPresent(Class<?> annotationClass, ClassAccessor accessor)
INTERNAL: Indicates whether the specified annotation is present on java class for the given descriptor metadata.
-
isAnnotationPresent
public boolean isAnnotationPresent(String annotation)
INTERNAL: Indicates whether the specified annotation is present on this accessible object. NOTE: Calling this method directly does not take any metadata complete flag into consideration. Look at the other isAnnotationPresent methods that takes a class accessor.
-
isAnnotationPresent
public boolean isAnnotationPresent(String annotationName, ClassAccessor accessor)
INTERNAL: Indicates whether the specified annotation is present on java class for the given descriptor metadata.
-
isArray
public boolean isArray(ClassAccessor classAccessor)
INTERNAL: Return true if this field accessor represents an array relationship.
-
isBasic
public boolean isBasic(ClassAccessor classAccessor)
INTERNAL: Return true if this accessor represents a basic mapping.
-
isBasicCollection
public boolean isBasicCollection(ClassAccessor classAccessor)
INTERNAL: Return true if this accessor represents a basic collection mapping.
-
isBasicMap
public boolean isBasicMap(ClassAccessor classAccessor)
INTERNAL: Return true if this accessor represents a basic collection mapping.
-
isDerivedId
public boolean isDerivedId(ClassAccessor classAccessor)
INTERNAL: Return true if this accessor represents an id mapping.
-
isDerivedIdClass
public boolean isDerivedIdClass(ClassAccessor classAccessor)
INTERNAL: Return true if this accessor represents an id mapping.
-
isElementCollection
public boolean isElementCollection(ClassAccessor classAccessor)
INTERNAL: Return true if this accessor represents an element collection mapping.
-
isEmbedded
public boolean isEmbedded(ClassAccessor classAccessor)
INTERNAL: Return true if this accessor represents an aggregate mapping. True is returned if an Embedded annotation is found or if an Embeddable annotation is found on the raw/reference class.
-
isEmbeddedId
public boolean isEmbeddedId(ClassAccessor classAccessor)
INTERNAL: Return true if this accessor represents an aggregate id mapping.
-
isGenericCollectionType
public boolean isGenericCollectionType()
INTERNAL: Method to return whether a collection type is a generic.
-
isGenericType
public boolean isGenericType()
INTERNAL: Method to return whether a type is a generic.
-
isId
public boolean isId(ClassAccessor classAccessor)
INTERNAL: Return true if this accessor represents an id mapping.
-
isManyToMany
public boolean isManyToMany(ClassAccessor classAccessor)
INTERNAL: Return true if this field accessor represents a m-m relationship.
-
isManyToOne
public boolean isManyToOne(ClassAccessor classAccessor)
INTERNAL: Return true if this accessor represents a m-1 relationship.
-
isOneToMany
public boolean isOneToMany(ClassAccessor classAccessor)
INTERNAL: Return true if this accessor represents a 1-m relationship.
-
isOneToOne
public boolean isOneToOne(ClassAccessor classAccessor)
INTERNAL: Return true if this accessor represents a 1-1 relationship.
-
isStructure
public boolean isStructure(ClassAccessor classAccessor)
INTERNAL: Return true if this field accessor represents a structure relationship.
-
isSupportedCollectionClass
public boolean isSupportedCollectionClass(MetadataClass metadataClass)
INTERNAL: Method to return whether the given class is a supported collection class.
-
isSupportedMapClass
public boolean isSupportedMapClass(MetadataClass metadataClass)
INTERNAL: Method to return whether the given class is a supported map class.
-
isSupportedToManyCollectionClass
public boolean isSupportedToManyCollectionClass(MetadataClass metadataClass)
INTERNAL: Method to return whether the given class is a supported to many collection class.
-
isTransformation
public boolean isTransformation(ClassAccessor classAccessor)
INTERNAL: Return true if this accessor represents an transformation mapping.
-
isValidPersistenceElement
protected boolean isValidPersistenceElement(boolean mustBeExplicit, String explicitType, ClassAccessor classAccessor)INTERNAL: When processing the inverse accessors to an explicit access setting, their must be an Access(FIELD) or Access(PROPERTY) present for the element to be processed. Otherwise, it is ignored.
-
isValidPersistenceElement
protected boolean isValidPersistenceElement(int modifiers)
INTERNAL: Return true if the modifiers are not transient, static or abstract.
-
isVariableOneToOne
public boolean isVariableOneToOne(ClassAccessor classAccessor)
INTERNAL: Return true if this accessor represents a variable 1-1 relationship. The method will return true if one of the following conditions is met: - There is a VariableOneToOne annotation present, or - The raw class is an interface and not a collection or map, nor a ValueHolderInterface (and an exclude default mappings flag is not set)
-
isVersion
public boolean isVersion(ClassAccessor classAccessor)
INTERNAL: Return true if this accessor represents a version mapping.
-
setAnnotations
public void setAnnotations(Map<String,MetadataAnnotation> annotations)
INTERNAL: Set the annotations of this accessible object.
-
setAttributeName
public void setAttributeName(String attributeName)
INTERNAL:
-
setModifiers
public void setModifiers(int modifiers)
INTERNAL:
-
setName
public void setName(String name)
INTERNAL:
-
setPrimitiveType
public void setPrimitiveType(Object primitiveType)
INTERNAL: If this annotated element was built from java model elements and is a primitive type this method will be called.
-
setType
public void setType(String type)
INTERNAL:
-
-