Class Element

  • All Implemented Interfaces:
    java.lang.reflect.AnnotatedElement, java.lang.reflect.Member
    Direct Known Subclasses:
    Invokable

    class Element
    extends java.lang.reflect.AccessibleObject
    implements java.lang.reflect.Member
    Represents either a Field, a Method or a Constructor. Provides convenience methods such as isPublic() and isPackagePrivate().
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.lang.reflect.AccessibleObject accessibleObject  
      private java.lang.reflect.Member member  
      • Fields inherited from interface java.lang.reflect.Member

        DECLARED, PUBLIC
    • Constructor Summary

      Constructors 
      Constructor Description
      Element​(M member)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object obj)  
      <A extends java.lang.annotation.Annotation>
      A
      getAnnotation​(java.lang.Class<A> annotationClass)  
      java.lang.annotation.Annotation[] getAnnotations()  
      java.lang.annotation.Annotation[] getDeclaredAnnotations()  
      java.lang.Class<?> getDeclaringClass()  
      int getModifiers()  
      java.lang.String getName()  
      TypeToken<?> getOwnerType()  
      int hashCode()  
      boolean isAbstract()
      Returns true if the method is abstract.
      boolean isAccessible()  
      boolean isAnnotationPresent​(java.lang.Class<? extends java.lang.annotation.Annotation> annotationClass)  
      boolean isFinal()
      Returns true if this method is final, per Modifier.isFinal(getModifiers()).
      boolean isNative()
      Returns true if the element is native.
      boolean isPackagePrivate()
      Returns true if the element is package-private.
      boolean isPrivate()
      Returns true if the element is private.
      boolean isProtected()
      Returns true if the element is protected.
      boolean isPublic()
      Returns true if the element is public.
      boolean isStatic()
      Returns true if the element is static.
      boolean isSynchronized()
      Returns true if the method is synchronized.
      boolean isSynthetic()  
      (package private) boolean isTransient()
      Returns true if the field is transient.
      (package private) boolean isVolatile()
      Returns true if the field is volatile.
      void setAccessible​(boolean flag)  
      java.lang.String toString()  
      • Methods inherited from class java.lang.reflect.AccessibleObject

        canAccess, getAnnotationsByType, getDeclaredAnnotation, getDeclaredAnnotationsByType, setAccessible, trySetAccessible
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Field Detail

      • accessibleObject

        private final java.lang.reflect.AccessibleObject accessibleObject
      • member

        private final java.lang.reflect.Member member
    • Constructor Detail

      • Element

        Element​(M member)
    • Method Detail

      • getOwnerType

        public TypeToken<?> getOwnerType()
      • isAnnotationPresent

        public final boolean isAnnotationPresent​(java.lang.Class<? extends java.lang.annotation.Annotation> annotationClass)
        Specified by:
        isAnnotationPresent in interface java.lang.reflect.AnnotatedElement
        Overrides:
        isAnnotationPresent in class java.lang.reflect.AccessibleObject
      • getAnnotation

        public final <A extends java.lang.annotation.Annotation> A getAnnotation​(java.lang.Class<A> annotationClass)
        Specified by:
        getAnnotation in interface java.lang.reflect.AnnotatedElement
        Overrides:
        getAnnotation in class java.lang.reflect.AccessibleObject
      • getAnnotations

        public final java.lang.annotation.Annotation[] getAnnotations()
        Specified by:
        getAnnotations in interface java.lang.reflect.AnnotatedElement
        Overrides:
        getAnnotations in class java.lang.reflect.AccessibleObject
      • getDeclaredAnnotations

        public final java.lang.annotation.Annotation[] getDeclaredAnnotations()
        Specified by:
        getDeclaredAnnotations in interface java.lang.reflect.AnnotatedElement
        Overrides:
        getDeclaredAnnotations in class java.lang.reflect.AccessibleObject
      • setAccessible

        public final void setAccessible​(boolean flag)
                                 throws java.lang.SecurityException
        Overrides:
        setAccessible in class java.lang.reflect.AccessibleObject
        Throws:
        java.lang.SecurityException
      • isAccessible

        public final boolean isAccessible()
        Overrides:
        isAccessible in class java.lang.reflect.AccessibleObject
      • getDeclaringClass

        public java.lang.Class<?> getDeclaringClass()
        Specified by:
        getDeclaringClass in interface java.lang.reflect.Member
      • getName

        public final java.lang.String getName()
        Specified by:
        getName in interface java.lang.reflect.Member
      • getModifiers

        public final int getModifiers()
        Specified by:
        getModifiers in interface java.lang.reflect.Member
      • isSynthetic

        public final boolean isSynthetic()
        Specified by:
        isSynthetic in interface java.lang.reflect.Member
      • isPublic

        public final boolean isPublic()
        Returns true if the element is public.
      • isProtected

        public final boolean isProtected()
        Returns true if the element is protected.
      • isPackagePrivate

        public final boolean isPackagePrivate()
        Returns true if the element is package-private.
      • isPrivate

        public final boolean isPrivate()
        Returns true if the element is private.
      • isStatic

        public final boolean isStatic()
        Returns true if the element is static.
      • isFinal

        public final boolean isFinal()
        Returns true if this method is final, per Modifier.isFinal(getModifiers()).

        Note that a method may still be effectively "final", or non-overridable when it has no final keyword. For example, it could be private, or it could be declared by a final class. To tell whether a method is overridable, use Invokable.isOverridable().

      • isAbstract

        public final boolean isAbstract()
        Returns true if the method is abstract.
      • isNative

        public final boolean isNative()
        Returns true if the element is native.
      • isSynchronized

        public final boolean isSynchronized()
        Returns true if the method is synchronized.
      • isVolatile

        final boolean isVolatile()
        Returns true if the field is volatile.
      • isTransient

        final boolean isTransient()
        Returns true if the field is transient.
      • equals

        public boolean equals​(@Nullable
                              java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object