public class SuperMethodAnnotationScanner extends Object
| Modifier and Type | Method and Description |
|---|---|
static <A extends Annotation> |
annotationInHierarchy(Method m,
Class<A> t) |
static int |
compareAccess(int lhs,
int rhs) |
static <A extends Annotation> |
getAnnotation(Method m,
Class<A> t)
Returns the 0th element of the list returned by
getAnnotations, or null if the
list would be empty. |
static <A extends Annotation> |
getAnnotations(Method m,
Class<A> t)
Let
D be the class or interface which declares the method
m. |
static boolean |
isPackageAccess(int mods) |
static boolean |
overrides(Method a,
Method b) |
public static <A extends Annotation> A getAnnotation(Method m, Class<A> t)
getAnnotations, or null if the
list would be empty.A - the type of the annotation to find.m - the method to begin the search from.t - the type of the annotation to find.m, or present on any methods which
m overrides.NullPointerException - if any argument is null.public static <A extends Annotation> List<A> getAnnotations(Method m, Class<A> t)
D be the class or interface which declares the method
m.
Returns a list of all of the annotations of the specified type
which are either present on m, or present on any methods
declared by a supertype of D which m overrides.
Annotations are listed in order of nearest proximity to D,
that is, assuming D extends E and E extends F, then
the returned list would contain annotations in the order of
[D, E, F]. A bit more formally, if Sn is the nth
superclass of D (where n is an integer starting at 0),
then the index of the annotation present on Sn.m is n+1,
assuming annotations are present on m for every class.
Annotations from methods declared by the superinterfaces of D
appear last in the list, in order of their declaration,
recursively. For example, if class D implements X, Y and
interface X extends Z, then annotations will appear in the
list in the order of [D, X, Z, Y].
A - the type of the annotation to find.m - the method to begin the search from.t - the type of the annotation to find.m, or present on any
methods which m overrides.NullPointerException - if any argument is null.public static <A extends Annotation> boolean annotationInHierarchy(Method m, Class<A> t)
public static boolean overrides(Method a, Method b)
a - the method which may override b.b - the method which may be overridden by a.true if a probably overrides b
and false otherwise.NullPointerException - if any argument is null.public static boolean isPackageAccess(int mods)
public static int compareAccess(int lhs,
int rhs)
Copyright © 2022. All rights reserved.