org.apache.commons.beanutils
クラス MethodUtils

java.lang.Object
  |
  +--org.apache.commons.beanutils.MethodUtils

public class MethodUtils
extends java.lang.Object

Utility reflection methods focussed on methods in general rather than properties in particular.

作成者:
Craig R. McClanahan, Ralph Schaer, Chris Audley, Rey Fran?is, Gregor Ra?an, Jan Sorensen, Robert Burrell Donkin

コンストラクタの概要
MethodUtils()
           
 
メソッドの概要
static java.lang.reflect.Method getAccessibleMethod(java.lang.Class clazz, java.lang.String methodName, java.lang.Class parameterType)
          Return an accessible method (that is, one that can be invoked via reflection) with given name and a single parameter.
static java.lang.reflect.Method getAccessibleMethod(java.lang.Class clazz, java.lang.String methodName, java.lang.Class[] parameterTypes)
          Return an accessible method (that is, one that can be invoked via reflection) with given name and parameters.
static java.lang.reflect.Method getAccessibleMethod(java.lang.reflect.Method method)
          Return an accessible method (that is, one that can be invoked via reflection) that implements the specified Method.
private static java.lang.reflect.Method getAccessibleMethodFromInterfaceNest(java.lang.Class clazz, java.lang.String methodName, java.lang.Class[] parameterTypes)
          Return an accessible method (that is, one that can be invoked via reflection) that implements the specified method, by scanning through all implemented interfaces and subinterfaces.
static java.lang.Object invokeExactMethod(java.lang.Object object, java.lang.String methodName, java.lang.Object arg)
          Invoke a method whose parameter type matches exactly the object type. This is a convenient wrapper for invokeExactMethod(Object object,String methodName,Object [] args).
static java.lang.Object invokeExactMethod(java.lang.Object object, java.lang.String methodName, java.lang.Object[] args)
          Invoke a method whose parameter types match exactly the object types. This uses reflection to invoke the method obtained from a call to getAccessibleMethod(java.lang.Class, java.lang.String, java.lang.Class).
static java.lang.Object invokeExactMethod(java.lang.Object object, java.lang.String methodName, java.lang.Object[] args, java.lang.Class[] parameterTypes)
          Invoke a method whose parameter types match exactly the parameter types given. This uses reflection to invoke the method obtained from a call to getAccessibleMethod(java.lang.Class, java.lang.String, java.lang.Class).
 
クラス java.lang.Object から継承したメソッド
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

コンストラクタの詳細

MethodUtils

public MethodUtils()
メソッドの詳細

invokeExactMethod

public static java.lang.Object invokeExactMethod(java.lang.Object object,
                                                 java.lang.String methodName,
                                                 java.lang.Object arg)
                                          throws java.lang.NoSuchMethodException,
                                                 java.lang.IllegalAccessException,
                                                 java.lang.reflect.InvocationTargetException

Invoke a method whose parameter type matches exactly the object type.

This is a convenient wrapper for invokeExactMethod(Object object,String methodName,Object [] args).

パラメータ:
object - invoke method on this object
methodName - get method with this name
arg - use this argument

invokeExactMethod

public static java.lang.Object invokeExactMethod(java.lang.Object object,
                                                 java.lang.String methodName,
                                                 java.lang.Object[] args)
                                          throws java.lang.NoSuchMethodException,
                                                 java.lang.IllegalAccessException,
                                                 java.lang.reflect.InvocationTargetException

Invoke a method whose parameter types match exactly the object types.

This uses reflection to invoke the method obtained from a call to getAccessibleMethod(java.lang.Class, java.lang.String, java.lang.Class).

パラメータ:
object - invoke method on this object
methodName - get method with this name
args - use these arguments

invokeExactMethod

public static java.lang.Object invokeExactMethod(java.lang.Object object,
                                                 java.lang.String methodName,
                                                 java.lang.Object[] args,
                                                 java.lang.Class[] parameterTypes)
                                          throws java.lang.NoSuchMethodException,
                                                 java.lang.IllegalAccessException,
                                                 java.lang.reflect.InvocationTargetException

Invoke a method whose parameter types match exactly the parameter types given.

This uses reflection to invoke the method obtained from a call to getAccessibleMethod(java.lang.Class, java.lang.String, java.lang.Class).

パラメータ:
object - invoke method on this object
methodName - get method with this name
args - use these arguments
parameterTypes - match these parameters

getAccessibleMethod

public static java.lang.reflect.Method getAccessibleMethod(java.lang.Class clazz,
                                                           java.lang.String methodName,
                                                           java.lang.Class parameterType)

Return an accessible method (that is, one that can be invoked via reflection) with given name and a single parameter. If no such method can be found, return null. Basically, a convenience wrapper that constructs a Class array for you.

パラメータ:
clazz - get method from this class
methodName - get method with this name
parameterType - taking this type of parameter

getAccessibleMethod

public static java.lang.reflect.Method getAccessibleMethod(java.lang.Class clazz,
                                                           java.lang.String methodName,
                                                           java.lang.Class[] parameterTypes)

Return an accessible method (that is, one that can be invoked via reflection) with given name and parameters. If no such method can be found, return null. This is just a convenient wrapper for getAccessibleMethod(Method method).

パラメータ:
clazz - get method from this class
methodName - get method with this name
parameterTypes - with these parameters types

getAccessibleMethod

public static java.lang.reflect.Method getAccessibleMethod(java.lang.reflect.Method method)

Return an accessible method (that is, one that can be invoked via reflection) that implements the specified Method. If no such method can be found, return null.

パラメータ:
method - The method that we wish to call

getAccessibleMethodFromInterfaceNest

private static java.lang.reflect.Method getAccessibleMethodFromInterfaceNest(java.lang.Class clazz,
                                                                             java.lang.String methodName,
                                                                             java.lang.Class[] parameterTypes)

Return an accessible method (that is, one that can be invoked via reflection) that implements the specified method, by scanning through all implemented interfaces and subinterfaces. If no such method can be found, return null.

There isn't any good reason why this method must be private. It is because there doesn't seem any reason why other classes should call this rather than the higher level methods.

パラメータ:
clazz - Parent class for the interfaces to be checked
methodName - Method name of the method we wish to call
parameterTypes - The parameter type signatures


Copyright (c) 2001 - Apache Software Foundation