Class MethodInfo
- All Implemented Interfaces:
- Comparable<MethodInfo>
See Also:
- 
Constructor SummaryConstructorsModifierConstructorDescriptionprotectedMethodInfo(ClassInfo declaringClass, Method m) Constructor.
- 
Method SummaryModifier and TypeMethodDescriptionaccept(Predicate<MethodInfo> test, Consumer<MethodInfo> action) Performs an action on this object if the specified predicate test passes.Attempts to callx.setAccessible(and quietly ignores security exceptions.true )booleanargsOnlyOfType(Class<?>... args) Returnstrue if the parameters on the method only consist of the types specified in the list.booleanReturnstrue if this constructor can accept the specified arguments in the specified order.intcanAcceptFuzzy(Object... args) Returns the number of matching arguments for this method.int<A extends Annotation>
 MethodInfoforEachAnnotation(Class<A> type, Predicate<A> filter, Consumer<A> action) Performs an action on all matching annotations defined on this method.<A extends Annotation>
 MethodInfoforEachAnnotation(AnnotationProvider annotationProvider, Class<A> type, Predicate<A> filter, Consumer<A> action) Performs an action on all matching annotations defined on this method.forEachAnnotationInfo(Predicate<AnnotationInfo<?>> filter, Consumer<AnnotationInfo<?>> action) Perform an action on all matching annotations on this method.forEachMatching(Predicate<MethodInfo> filter, Consumer<MethodInfo> action) Performs an action on all matching declared methods with the same name and arguments on all superclasses and interfaces.forEachMatchingParentFirst(Predicate<MethodInfo> filter, Consumer<MethodInfo> action) Performs an action on all matching declared methods with the same name and arguments on all superclasses and interfaces.<A extends Annotation>
 AgetAnnotation(Class<A> type) Finds the annotation of the specified type defined on this method.<A extends Annotation>
 AgetAnnotation(AnnotationProvider annotationProvider, Class<A> type) Finds the annotation of the specified type defined on this method.Constructs anAnnotationListof all annotations found on this method.getAnnotationList(Predicate<AnnotationInfo<?>> filter) Constructs anAnnotationListof all matching annotations found on this method.getAnnotationListMethodOnly(Predicate<AnnotationInfo<?>> filter) Same asgetAnnotationList(Predicate)except only returns annotations defined on methods.final AnnotationgetAnyAnnotation(Class<? extends Annotation>... types) Returns the first annotation in the specified list on this method.getName()Returns the name of this method.Returns the bean property name if this is a getter or setter.Returns the generic return type of this method as aClassInfoobject.Returns the signature of this method.booleanhasAllArgs(Class<?>... requiredParams) Returnstrue if this method has at least the specified parameters.<A extends Annotation>
 booleanhasAnnotation(Class<A> type) Returnstrue if the specified annotation is present on this method.<A extends Annotation>
 booleanhasAnnotation(AnnotationProvider annotationProvider, Class<A> type) Returnstrue if the specified annotation is present on this method.final booleanhasAnyAnnotations(Class<? extends Annotation>... types) Returnstrue if at least one of the specified annotation is present on this method.booleanReturnstrue if this method has the specified parameter.<A extends Annotation>
 booleanhasNoAnnotation(Class<A> type) Returnstrue if the specified annotation is not present on this method.<A extends Annotation>
 booleanhasNoAnnotation(AnnotationProvider annotationProvider, Class<A> type) Returnstrue if the specified annotation is not present on this method.booleanhasReturnType(Class<?> c) Returnstrue if this method has this return type.booleanReturnstrue if this method has this return type.booleanhasReturnTypeParent(Class<?> c) Returnstrue if this method has this parent return type.booleanReturnstrue if this method has this parent return type.inner()Returns the wrapped method.<T> TShortcut for calling the invoke method on the underlying method.invokeFuzzy(Object pojo, Object... args) Invokes the specified method using fuzzy-arg matching.booleanisBridge()Returnstrue if this method is a bridge method.booleanmatches(Predicate<MethodInfo> test) Returnstrue if this object passes the specified predicate test.static MethodInfoConvenience method for instantiating aMethodInfo;static MethodInfoConvenience method for instantiating aMethodInfo;static MethodInfoConvenience method for instantiating aMethodInfo;Methods inherited from class org.apache.juneau.reflect.ExecutableInfoforEachParam, forEachParameterAnnotation, fuzzyArgsMatch, fuzzyArgsMatch, fuzzyArgsMatch, getDeclaringClass, getExceptionTypes, getFullName, getParam, getParamCount, getParams, getParamType, getParamTypes, getRawGenericParamType, getRawGenericParamTypes, getRawParameter, getRawParameters, getRawParamType, getRawParamTypes, getShortName, getSimpleName, hasFuzzyParamTypes, hasFuzzyParamTypes, hasMatchingParamTypes, hasMatchingParamTypes, hasName, hasName, hasName, hasNoParams, hasNumParams, hasParams, hasParamTypes, hasParamTypes, is, isAbstract, isAll, isAny, isConstructor, isDeprecated, isNotAbstract, isNotDeprecated, isNotProtected, isNotPublic, isNotStatic, isProtected, isPublic, isStatic, isVisible, setAccessible, toString
- 
Constructor Details- 
MethodInfoConstructor.- Parameters:
- declaringClass- The class that declares this method.
- m- The method being wrapped.
 
 
- 
- 
Method Details- 
ofConvenience method for instantiating aMethodInfo;- Parameters:
- declaringClass- The class that declares this method.
- m- The method being wrapped.
- Returns:
- A new MethodInfoobject, ornull if the method was null;
 
- 
ofConvenience method for instantiating aMethodInfo;- Parameters:
- declaringClass- The class that declares this method.
- m- The method being wrapped.
- Returns:
- A new MethodInfoobject, ornull if the method was null;
 
- 
ofConvenience method for instantiating aMethodInfo;- Parameters:
- m- The method being wrapped.
- Returns:
- A new MethodInfoobject, ornull if the method was null;
 
- 
innerReturns the wrapped method.- Returns:
- The wrapped method.
 
- 
canAcceptReturnstrue if this constructor can accept the specified arguments in the specified order.- Parameters:
- args- The arguments to check.
- Returns:
- true if this constructor can accept the specified arguments in the specified order.
 
- 
canAcceptFuzzyReturns the number of matching arguments for this method.- Parameters:
- args- The arguments to check.
- Returns:
- the number of matching arguments for this method.
 
- 
forEachMatchingPerforms an action on all matching declared methods with the same name and arguments on all superclasses and interfaces.Methods are accessed from child-to-parent order. - Parameters:
- filter- A predicate to apply to the entries to determine if action should be performed. Can be- null .
- action- An action to perform on the entry.
- Returns:
- This object.
 
- 
forEachMatchingParentFirstpublic MethodInfo forEachMatchingParentFirst(Predicate<MethodInfo> filter, Consumer<MethodInfo> action) Performs an action on all matching declared methods with the same name and arguments on all superclasses and interfaces.Methods are accessed from parent-to-child order. - Parameters:
- filter- A predicate to apply to the entries to determine if action should be performed. Can be- null .
- action- An action to perform on the entry.
- Returns:
- This object.
 
- 
getAnnotationFinds the annotation of the specified type defined on this method.If this is a method and the annotation cannot be found on the immediate method, searches methods with the same signature on the parent classes or interfaces. 
 The search is performed in child-to-parent order.- Type Parameters:
- A- The annotation type to look for.
- Parameters:
- type- The annotation to look for.
- Returns:
- The annotation if found, or null if not.
 
- 
getAnnotationFinds the annotation of the specified type defined on this method.Searches all methods with the same signature on the parent classes or interfaces and the return type on the method. - Type Parameters:
- A- The annotation type to look for.
- Parameters:
- annotationProvider- The annotation provider.
- type- The annotation to look for.
- Returns:
- The first annotation found, or null if it doesn't exist.
 
- 
hasAnnotationReturnstrue if the specified annotation is present on this method.- Type Parameters:
- A- The annotation type to look for.
- Parameters:
- type- The annotation to look for.
- Returns:
- true if the specified annotation is present on this method.
 
- 
hasAnnotationpublic <A extends Annotation> boolean hasAnnotation(AnnotationProvider annotationProvider, Class<A> type) Returnstrue if the specified annotation is present on this method.- Type Parameters:
- A- The annotation type to look for.
- Parameters:
- annotationProvider- The annotation provider.
- type- The annotation to look for.
- Returns:
- true if the specified annotation is present on this method.
 
- 
hasNoAnnotationpublic <A extends Annotation> boolean hasNoAnnotation(AnnotationProvider annotationProvider, Class<A> type) Returnstrue if the specified annotation is not present on this method.- Type Parameters:
- A- The annotation type to look for.
- Parameters:
- annotationProvider- The annotation provider.
- type- The annotation to look for.
- Returns:
- true if the specified annotation is not present on this method.
 
- 
hasNoAnnotationReturnstrue if the specified annotation is not present on this method.- Type Parameters:
- A- The annotation type to look for.
- Parameters:
- type- The annotation to look for.
- Returns:
- true if the specified annotation is not present on this method.
 
- 
hasAnyAnnotationsReturnstrue if at least one of the specified annotation is present on this method.- Parameters:
- types- The annotation to look for.
- Returns:
- true if at least one of the specified annotation is present on this method.
 
- 
forEachAnnotationpublic <A extends Annotation> MethodInfo forEachAnnotation(Class<A> type, Predicate<A> filter, Consumer<A> action) Performs an action on all matching annotations defined on this method.Searches all methods with the same signature on the parent classes or interfaces and the return type on the method. 
 Results are parent-to-child ordered.- Type Parameters:
- A- The annotation type to look for.
- Parameters:
- type- The annotation to look for.
- filter- A predicate to apply to the entries to determine if action should be performed. Can be- null .
- action- An action to perform on the entry.
- Returns:
- This object.
 
- 
forEachAnnotationpublic <A extends Annotation> MethodInfo forEachAnnotation(AnnotationProvider annotationProvider, Class<A> type, Predicate<A> filter, Consumer<A> action) Performs an action on all matching annotations defined on this method.Searches all methods with the same signature on the parent classes or interfaces and the return type on the method. 
 Results are parent-to-child ordered.- Type Parameters:
- A- The annotation type to look for.
- Parameters:
- annotationProvider- The annotation provider.
- type- The annotation type.
- filter- A predicate to apply to the entries to determine if action should be performed. Can be- null .
- action- An action to perform on the entry.
- Returns:
- This object.
 
- 
getAnyAnnotationReturns the first annotation in the specified list on this method.- Parameters:
- types- The annotations to look for.
- Returns:
- The first matching annotation.
 
- 
getAnnotationListConstructs anAnnotationListof all annotations found on this method.Annotations are appended in the following orders: - On the package of this class.
- On interfaces ordered parent-to-child.
- On parent classes ordered parent-to-child.
- On this class.
- On this method and matching methods ordered parent-to-child.
 - Returns:
- A new AnnotationListobject on every call.
 
- 
getAnnotationListConstructs anAnnotationListof all matching annotations found on this method.Annotations are appended in the following orders: - On the package of this class.
- On interfaces ordered parent-to-child.
- On parent classes ordered parent-to-child.
- On this class.
- On this method and matching methods ordered parent-to-child.
 - Parameters:
- filter- A predicate to apply to the entries to determine if value should be added. Can be- null .
- Returns:
- A new AnnotationListobject on every call.
 
- 
getAnnotationListMethodOnlySame asgetAnnotationList(Predicate)except only returns annotations defined on methods.- Parameters:
- filter- A predicate to apply to the entries to determine if value should be added. Can be- null .
- Returns:
- A new AnnotationListobject on every call.
 
- 
forEachAnnotationInfopublic MethodInfo forEachAnnotationInfo(Predicate<AnnotationInfo<?>> filter, Consumer<AnnotationInfo<?>> action) Perform an action on all matching annotations on this method.- Parameters:
- filter- A predicate to apply to the entries to determine if action should be performed. Can be- null .
- action- An action to perform on the entry.
- Returns:
- This object.
 
- 
getReturnTypeReturns the generic return type of this method as aClassInfoobject.- Returns:
- The generic return type of this method.
 
- 
hasReturnTypeReturnstrue if this method has this return type.- Parameters:
- c- The return type to test for.
- Returns:
- true if this method has this return type.
 
- 
hasReturnTypeReturnstrue if this method has this return type.- Parameters:
- ci- The return type to test for.
- Returns:
- true if this method has this return type.
 
- 
hasReturnTypeParentReturnstrue if this method has this parent return type.- Parameters:
- c- The return type to test for.
- Returns:
- true if this method has this parent return type.
 
- 
hasReturnTypeParentReturnstrue if this method has this parent return type.- Parameters:
- ci- The return type to test for.
- Returns:
- true if this method has this parent return type.
 
- 
matchesReturnstrue if this object passes the specified predicate test.- Parameters:
- test- The test to perform.
- Returns:
- true if this object passes the specified predicate test.
 
- 
acceptPerforms an action on this object if the specified predicate test passes.- Parameters:
- test- A test to apply to determine if action should be executed. Can be- null .
- action- An action to perform on this object.
- Returns:
- This object.
 
- 
invokeShortcut for calling the invoke method on the underlying method.- Type Parameters:
- T- The method return type.
- Parameters:
- obj- the object the underlying method is invoked from.
- args- the arguments used for the method call
- Returns:
- The object returned from the method.
- Throws:
- ExecutableException- Exception occurred on invoked constructor/method/field.
 
- 
invokeFuzzyInvokes the specified method using fuzzy-arg matching.Arguments will be matched to the parameters based on the parameter types. 
 Arguments can be in any order.
 Extra arguments will be ignored.
 Missing arguments will be leftnull .Note that this only works for methods that have distinguishable argument types. 
 It's not going to work on methods with generic argument types likeObject - Parameters:
- pojo- The POJO the method is being called on.
 Can be- null for static methods.
- args- The arguments to pass to the method.
- Returns:
- The results of the method invocation.
- Throws:
- ExecutableException- Exception occurred on invoked constructor/method/field.
 
- 
getSignatureReturns the signature of this method.For no-arg methods, the signature will be a simple string such as "toString" . For methods with one or more args, the arguments will be fully-qualified class names (e.g."append(java.util.StringBuilder,boolean)" )- Returns:
- The methods signature.
 
- 
getPropertyNameReturns the bean property name if this is a getter or setter.- Returns:
- The bean property name, or null if this isn't a getter or setter.
 
- 
argsOnlyOfTypeReturnstrue if the parameters on the method only consist of the types specified in the list.Example:// Example method: public void foo(Stringbar , Integerbaz ); argsOnlyOfType(fooMethod , String.class , Integer.class );// True. argsOnlyOfType(fooMethod , String.class , Integer.class , Map.class );// True. argsOnlyOfType(fooMethod , String.class );// False. - Parameters:
- args- The valid class types (exact) for the arguments.
- Returns:
- true if the method parameters only consist of the types specified in the list.
 
- 
hasAllArgsReturnstrue if this method has at least the specified parameters.Method may or may not have additional parameters besides those specified. - Parameters:
- requiredParams- The parameter types to check for.
- Returns:
- true if this method has at least the specified parameters.
 
- 
hasArgReturnstrue if this method has the specified parameter.Method may or may not have additional parameters besides the one specified. - Parameters:
- requiredParam- The parameter type to check for.
- Returns:
- true if this method has at least the specified parameter.
 
- 
isBridgeReturnstrue if this method is a bridge method.- Returns:
- true if this method is a bridge method.
 
- 
getNameReturns the name of this method.- Returns:
- The name of this method
 
- 
compareTo- Specified by:
- compareToin interface- Comparable<MethodInfo>
 
- 
accessibleDescription copied from class:ExecutableInfoAttempts to callx.setAccessible(and quietly ignores security exceptions.true )- Overrides:
- accessiblein class- ExecutableInfo
- Returns:
- This object.
 
 
-