APIdia Launch Partner
Top Description Fields Constructors Methods
com.sun.beans.finder

public final Class MethodFinder

extends AbstractFinder<Method>
Class Inheritance
Imports
com.sun.beans.TypeResolver, com.sun.beans.util.Cache, java.lang.reflect.Method, .Modifier, .ParameterizedType, .Type, java.util.Arrays

This utility class provides static methods to find a public method with specified name and parameter types in specified class.
Author
Sergey A. Malenkov
Since
1.7

Field Summary

Modifier and TypeField and Description
private static final Cache<Signature, Method>
private final String

Constructor Summary

AccessConstructor and Description
private
MethodFinder(String
the name of method to find
name
,
Class<?>[]
the array of parameter types
args
)

Creates method finder with specified array of parameter types.

Method Summary

Modifier and TypeMethod and Description
public static Method

Returns:

object that represents accessible method
findAccessibleMethod
(Method
object that represents found method
method
)

Finds method that is accessible from public class or interface through class hierarchy.

private static Method

Returns:

object that represents accessible method
findAccessibleMethod
(Method
object that represents found method
method
,
Type
generic type that is used to find accessible method
generic
)

Finds method that accessible from specified class.

public static Method

Returns:

object that represents found method
findInstanceMethod
(Class<?>
the class that can have method
type
,
String
the name of method to find
name
,
Class<?>...
parameter types that is used to find method
args
)

Finds public non-static method that is accessible from public class.

public static Method

Returns:

object that represents found method
findMethod
(Class<?>
the class that can have method
type
,
String
the name of method to find
name
,
Class<?>...
parameter types that is used to find method
args
)

Finds public method (static or non-static) that is accessible from public class.

public static Method

Returns:

object that represents found method
findStaticMethod
(Class<?>
the class that can have method
type
,
String
the name of method to find
name
,
Class<?>...
parameter types that is used to find method
args
)

Finds public static method that is accessible from public class.

protected boolean

Returns:

true if the method is valid, false otherwise
isValid
(Method
the object that represents method
method
)

Overrides com.sun.beans.finder.AbstractFinder.isValid.

Checks validness of the method.

Inherited from com.sun.beans.finder.AbstractFinder:
find

Field Detail

CACHEback to summary
private static final Cache<Signature, Method> CACHE
nameback to summary
private final String name

Constructor Detail

MethodFinderback to summary
private MethodFinder(String name, Class<?>[] args)

Creates method finder with specified array of parameter types.

Parameters
name:String

the name of method to find

args:Class<?>[]

the array of parameter types

Method Detail

findAccessibleMethodback to summary
public static Method findAccessibleMethod(Method method) throws NoSuchMethodException

Finds method that is accessible from public class or interface through class hierarchy.

Parameters
method:Method

object that represents found method

Returns:Method

object that represents accessible method

Exceptions
NoSuchMethodException:
if method is not accessible or is not found in specified superclass or interface
findAccessibleMethodback to summary
private static Method findAccessibleMethod(Method method, Type generic) throws NoSuchMethodException

Finds method that accessible from specified class.

Parameters
method:Method

object that represents found method

generic:Type

generic type that is used to find accessible method

Returns:Method

object that represents accessible method

Exceptions
NoSuchMethodException:
if method is not accessible or is not found in specified superclass or interface
findInstanceMethodback to summary
public static Method findInstanceMethod(Class<?> type, String name, Class<?>... args) throws NoSuchMethodException

Finds public non-static method that is accessible from public class.

Parameters
type:Class<?>

the class that can have method

name:String

the name of method to find

args:Class<?>[]

parameter types that is used to find method

Returns:Method

object that represents found method

Exceptions
NoSuchMethodException:
if method could not be found or some methods are found
findMethodback to summary
public static Method findMethod(Class<?> type, String name, Class<?>... args) throws NoSuchMethodException

Finds public method (static or non-static) that is accessible from public class.

Parameters
type:Class<?>

the class that can have method

name:String

the name of method to find

args:Class<?>[]

parameter types that is used to find method

Returns:Method

object that represents found method

Exceptions
NoSuchMethodException:
if method could not be found or some methods are found
findStaticMethodback to summary
public static Method findStaticMethod(Class<?> type, String name, Class<?>... args) throws NoSuchMethodException

Finds public static method that is accessible from public class.

Parameters
type:Class<?>

the class that can have method

name:String

the name of method to find

args:Class<?>[]

parameter types that is used to find method

Returns:Method

object that represents found method

Exceptions
NoSuchMethodException:
if method could not be found or some methods are found
isValidback to summary
protected boolean isValid(Method method)

Overrides com.sun.beans.finder.AbstractFinder.isValid.

Checks validness of the method. The valid method should be public and should have the specified name.

Parameters
method:Method

the object that represents method

Returns:boolean

true if the method is valid, false otherwise

Annotations
@Override