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
  • Field Details

  • Constructor Details

    • MetadataAnnotatedElement

      public MetadataAnnotatedElement(MetadataFactory factory)
      INTERNAL:
  • Method Details

    • addAnnotation

      public void addAnnotation(MetadataAnnotation annotation)
      INTERNAL:
    • addMetaAnnotation

      public void addMetaAnnotation(MetadataAnnotation annotation)
      INTERNAL:
    • addGenericType

      public void addGenericType(String genericType)
      INTERNAL:
    • equals

      public boolean equals(Object object)
      INTERNAL:
      Overrides:
      equals in class Object
    • 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 name
      names - meta-annotations names cycle detection set, shall not be null
    • 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:
      getAttributeName in class MetadataAccessibleObject
    • getDeclaredAnnotationsCount

      protected int getDeclaredAnnotationsCount(ClassAccessor classAccessor)
      INTERNAL:
    • getGenericType

      public List<String> getGenericType()
      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:
      getName in class MetadataAccessibleObject
    • 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.
      See Also:
    • 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.
      See Also:
    • 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.
    • hashCode

      public int hashCode()
      INTERNAL:
      Overrides:
      hashCode in class Object
    • 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:
    • setGenericType

      public void setGenericType(List<String> genericType)
      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:
    • toString

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