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

pack-priv abstract Class AbstractFinder<T extends Executable>

extends Object
Class Inheritance
Known Direct Subclasses
com.sun.beans.finder.ConstructorFinder, com.sun.beans.finder.MethodFinder
Imports
java.lang.reflect.Executable, .Modifier, java.util.HashMap, .Map

This abstract class provides functionality to find a public method or constructor with specified parameter types. It supports a variable number of parameters.
Author
Sergey A. Malenkov
Since
1.7

Field Summary

Modifier and TypeField and Description
private final Class<?>[]

Constructor Summary

AccessConstructor and Description
protected
AbstractFinder(Class<?>[]
array of classes of arguments
args
)

Creates finder for array of classes of arguments.

Method Summary

Modifier and TypeMethod and Description
pack-priv final T

Returns:

the object that represents found method
find
(T[]
the array of methods to search within
methods
)

Performs a search in the methods array.

private boolean

Returns:

true if all classes in min array are assignable from corresponding classes in max array, false otherwise
isAssignable
(Class<?>[]
the array of classes to be checked
min
,
Class<?>[]
the array of classes that is used to check
max
)

Determines if every class in min array is either the same as, or is a superclass of, the corresponding class in max array.

protected boolean

Returns:

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

Checks validness of the method.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

argsback to summary
private final Class<?>[] args

Constructor Detail

AbstractFinderback to summary
protected AbstractFinder(Class<?>[] args)

Creates finder for array of classes of arguments. If a particular element of array equals null, than the appropriate pair of classes does not take into consideration.

Parameters
args:Class<?>[]

array of classes of arguments

Method Detail

findback to summary
pack-priv final T find(T[] methods) throws NoSuchMethodException

Performs a search in the methods array. The one method is selected from the array of the valid methods. The list of parameters of the selected method shows the best correlation with the list of arguments specified at class initialization. If more than one method is both accessible and applicable to a method invocation, it is necessary to choose one to provide the descriptor for the run-time method dispatch. The most specific method should be chosen.

Parameters
methods:T[]

the array of methods to search within

Returns:T

the object that represents found method

Exceptions
NoSuchMethodException:
if no method was found or several methods meet the search criteria
See Also
isAssignable
isAssignableback to summary
private boolean isAssignable(Class<?>[] min, Class<?>[] max)

Determines if every class in min array is either the same as, or is a superclass of, the corresponding class in max array. The length of every array must equal the number of arguments. This comparison is performed in the find method before the first call of the isAssignable method. If an argument equals null the appropriate pair of classes does not take into consideration.

Parameters
min:Class<?>[]

the array of classes to be checked

max:Class<?>[]

the array of classes that is used to check

Returns:boolean

true if all classes in min array are assignable from corresponding classes in max array, false otherwise

See Also
Class#isAssignableFrom
isValidback to summary
protected boolean isValid(T method)

Checks validness of the method. At least the valid method should be public.

Parameters
method:T

the object that represents method

Returns:boolean

true if the method is valid, false otherwise