Class AbstractMethod

  • All Implemented Interfaces:
    AnnotatedElement
    Direct Known Subclasses:
    Constructor, Method

    public abstract class AbstractMethod
    extends AccessibleObject
    This class represents an abstract method. Abstract methods are either methods or constructors.
    • Field Detail

      • accessFlags

        protected int accessFlags
        Bits encoding access (e.g. public, private) as well as other runtime specific flags
      • artMethod

        protected long artMethod
        The ArtMethod associated with this Method, requried for dispatching due to entrypoints Classloader is held live by the declaring class. Hidden to workaround b/16828157.
      • declaringClass

        protected Class<?> declaringClass
        Method's declaring class
      • declaringClassOfOverriddenMethod

        protected Class<?> declaringClassOfOverriddenMethod
        Overriden method's declaring class (same as declaringClass unless declaringClass is a proxy class)
      • dexMethodIndex

        protected int dexMethodIndex
        The method index of this method within its defining dex file
    • Constructor Detail

      • AbstractMethod

        protected AbstractMethod()
        Hidden to workaround b/16828157.
    • Method Detail

      • getAnnotation

        public <T extends Annotation> T getAnnotation​(Class<T> annotationClass)
        Description copied from interface: AnnotatedElement
        Returns, for this element, the annotation with the specified type, or null if no annotation with the specified type is present (including inherited annotations).
        Specified by:
        getAnnotation in interface AnnotatedElement
        Overrides:
        getAnnotation in class AccessibleObject
        Parameters:
        annotationClass - the type of the annotation to search for
        Returns:
        the annotation with the specified type or null
      • getAccessFlags

        public final int getAccessFlags()
      • getDexMethodIndex

        public final int getDexMethodIndex()
        Returns the index of this method's ID in its dex file.
      • getName

        public abstract String getName()
        Returns the name of the method or constructor represented by this instance.
        Returns:
        the name of this method
      • equals

        public boolean equals​(Object other)
        Returns true if other has the same declaring class, name, parameters and return type as this method.
        Overrides:
        equals in class Object
        Parameters:
        other - the object to compare this instance with.
        Returns:
        true if the specified object is equal to this Object; false otherwise.
        See Also:
        Object.hashCode()
      • isAnnotationPresent

        public boolean isAnnotationPresent​(Class<? extends Annotation> annotationType)
        Description copied from interface: AnnotatedElement
        Indicates whether or not this element has an annotation with the specified annotation type (including inherited annotations).
        Specified by:
        isAnnotationPresent in interface AnnotatedElement
        Overrides:
        isAnnotationPresent in class AccessibleObject
        Parameters:
        annotationType - the type of the annotation to search for
        Returns:
        true if the annotation exists, false otherwise
      • getAnnotations

        public Annotation[] getAnnotations()
        Description copied from interface: AnnotatedElement
        Returns, for this element, an array containing all annotations (including inherited annotations). If there are no annotations present, this method returns a zero length array.
        Specified by:
        getAnnotations in interface AnnotatedElement
        Overrides:
        getAnnotations in class AccessibleObject
        Returns:
        an array of all annotations for this element
      • getParameterAnnotations

        public abstract Annotation[][] getParameterAnnotations()
        Returns an array of arrays that represent the annotations of the formal parameters of this method. If there are no parameters on this method, then an empty array is returned. If there are no annotations set, then and array of empty arrays is returned.
        Returns:
        an array of arrays of Annotation instances
      • equalMethodParameters

        protected boolean equalMethodParameters​(Class<?>[] params)
      • compareParameters

        protected int compareParameters​(Class<?>[] params)