public class Methods extends Object
Modifier and Type | Method | Description |
---|---|---|
static Object |
invoke(Object obj,
String methodName) |
Invokes the specified accessible parameterless method if it exists.
|
static Object |
invoke(Object obj,
String methodName,
boolean newValue) |
Invokes the specified setter method if it exists.
|
static Object |
invoke(Object obj,
String methodName,
float newValue) |
Invokes the specified setter method if it exists.
|
static Object |
invoke(Object obj,
String methodName,
int newValue) |
Invokes the specified method if it exists.
|
static Object |
invoke(Object obj,
String methodName,
Class[] types,
Object[] values) |
Invokes the specified method if it exists.
|
static Object |
invoke(Object obj,
String methodName,
Class clazz,
Object newValue) |
Invokes the specified setter method if it exists.
|
static Object |
invoke(Object obj,
String methodName,
String stringParameter) |
Invokes the specified accessible method with a string parameter if it exists.
|
static boolean |
invokeGetter(Object obj,
String methodName,
boolean defaultValue) |
Invokes the specified getter method if it exists.
|
static int |
invokeGetter(Object obj,
String methodName,
int defaultValue) |
Invokes the specified getter method if it exists.
|
static long |
invokeGetter(Object obj,
String methodName,
long defaultValue) |
Invokes the specified getter method if it exists.
|
static Object |
invokeGetter(Object obj,
String methodName,
Object defaultValue) |
Invokes the specified getter method if it exists.
|
static void |
invokeIfExists(Object obj,
String methodName) |
Invokes the specified setter method if it exists.
|
static void |
invokeIfExists(Object obj,
String methodName,
boolean newValue) |
Invokes the specified method if it exists.
|
static void |
invokeIfExists(Object obj,
String methodName,
float newValue) |
Invokes the specified setter method if it exists.
|
static void |
invokeIfExists(Object obj,
String methodName,
int newValue) |
Invokes the specified setter method if it exists.
|
static void |
invokeIfExists(Object obj,
String methodName,
Class parameterClass,
Object newValue) |
Invokes the specified setter method if it exists.
|
static void |
invokeIfExistsWithEnum(Object obj,
String methodName,
String enumClassName,
String enumValueName) |
Invokes the specified setter method if it exists.
|
static Object |
invokeStatic(Class clazz,
String methodName) |
Invokes the specified accessible parameterless method if it exists.
|
static Object |
invokeStatic(Class clazz,
String methodName,
Class[] types,
Object[] values) |
Invokes the specified static method if it exists.
|
static Object |
invokeStatic(Class clazz,
String methodName,
Class type,
Object value) |
Invokes the specified static method if it exists.
|
static Object |
invokeStatic(String clazz,
String methodName) |
Invokes the specified static parameterless method if it exists.
|
static Object |
invokeStatic(String clazz,
String methodName,
Class[] types,
Object[] values) |
Invokes the specified static method if it exists.
|
static Object |
invokeStatic(String clazz,
String methodName,
Class[] types,
Object[] values,
Object defaultValue) |
Invokes the specified static method if it exists.
|
static Object |
invokeStatic(String clazz,
String methodName,
Class type,
Object value) |
Invokes the specified static method if it exists.
|
static boolean |
invokeStaticGetter(Class clazz,
String methodName,
boolean defaultValue) |
Invokes the specified getter method if it exists.
|
static Object |
newInstance(Class clazz,
Class[] types,
Object[] values) |
Invokes the specified constructor if it exists.
|
public static Object invoke(Object obj, String methodName) throws NoSuchMethodException
obj
- The object on which to invoke the method.methodName
- The name of the method.NoSuchMethodException
public static Object invoke(Object obj, String methodName, String stringParameter) throws NoSuchMethodException
obj
- The object on which to invoke the method.methodName
- The name of the method.stringParameter
- The String parameterNoSuchMethodException
public static Object invoke(Object obj, String methodName, Class[] types, Object[] values) throws NoSuchMethodException
obj
- The object on which to invoke the method.methodName
- The name of the method.types
- The parameter types.values
- The parameter values.NoSuchMethodException
public static Object invokeStatic(Class clazz, String methodName) throws NoSuchMethodException
clazz
- The class on which to invoke the method.methodName
- The name of the method.NoSuchMethodException
public static Object invokeStatic(String clazz, String methodName) throws NoSuchMethodException
clazz
- The class on which to invoke the method.methodName
- The name of the method.NoSuchMethodException
public static Object invokeStatic(Class clazz, String methodName, Class[] types, Object[] values) throws NoSuchMethodException
clazz
- The class on which to invoke the method.methodName
- The name of the method.types
- The parameter types.values
- The parameter values.NoSuchMethodException
public static Object invokeStatic(String clazz, String methodName, Class[] types, Object[] values) throws NoSuchMethodException
clazz
- The class on which to invoke the method.methodName
- The name of the method.types
- The parameter types.values
- The parameter values.NoSuchMethodException
public static Object invokeStatic(String clazz, String methodName, Class type, Object value) throws NoSuchMethodException
clazz
- The class on which to invoke the method.methodName
- The name of the method.type
- The parameter types.value
- The parameter values.NoSuchMethodException
public static Object invokeStatic(String clazz, String methodName, Class[] types, Object[] values, Object defaultValue)
clazz
- The class on which to invoke the method.methodName
- The name of the method.types
- The parameter types.values
- The parameter values.defaultValue
- The default value.public static Object invokeStatic(Class clazz, String methodName, Class type, Object value) throws NoSuchMethodException
clazz
- The class on which to invoke the method.methodName
- The name of the method.type
- The parameter type.value
- The parameter value.NoSuchMethodException
public static int invokeGetter(Object obj, String methodName, int defaultValue)
obj
- The object on which to invoke the method.methodName
- The name of the method.defaultValue
- This value is returned, if the method does not exist.public static long invokeGetter(Object obj, String methodName, long defaultValue)
obj
- The object on which to invoke the method.methodName
- The name of the method.defaultValue
- This value is returned, if the method does not exist.public static boolean invokeGetter(Object obj, String methodName, boolean defaultValue)
obj
- The object on which to invoke the method.methodName
- The name of the method.defaultValue
- This value is returned, if the method does not exist.public static Object invokeGetter(Object obj, String methodName, Object defaultValue)
obj
- The object on which to invoke the method.methodName
- The name of the method.defaultValue
- This value is returned, if the method does not exist.public static boolean invokeStaticGetter(Class clazz, String methodName, boolean defaultValue)
clazz
- The class on which to invoke the method.methodName
- The name of the method.defaultValue
- This value is returned, if the method does not exist.public static Object invoke(Object obj, String methodName, boolean newValue) throws NoSuchMethodException
obj
- The object on which to invoke the method.methodName
- The name of the method.NoSuchMethodException
public static Object invoke(Object obj, String methodName, int newValue) throws NoSuchMethodException
obj
- The object on which to invoke the method.methodName
- The name of the method.NoSuchMethodException
public static Object invoke(Object obj, String methodName, float newValue) throws NoSuchMethodException
obj
- The object on which to invoke the method.methodName
- The name of the method.NoSuchMethodException
public static Object invoke(Object obj, String methodName, Class clazz, Object newValue) throws NoSuchMethodException
obj
- The object on which to invoke the method.methodName
- The name of the method.NoSuchMethodException
public static void invokeIfExists(Object obj, String methodName)
obj
- The object on which to invoke the method.methodName
- The name of the method.public static void invokeIfExists(Object obj, String methodName, int newValue)
obj
- The object on which to invoke the method.methodName
- The name of the method.public static void invokeIfExists(Object obj, String methodName, float newValue)
obj
- The object on which to invoke the method.methodName
- The name of the method.public static void invokeIfExists(Object obj, String methodName, boolean newValue)
obj
- The object on which to invoke the method.methodName
- The name of the method.public static void invokeIfExists(Object obj, String methodName, Class parameterClass, Object newValue)
obj
- The object on which to invoke the method.methodName
- The name of the method.public static void invokeIfExistsWithEnum(Object obj, String methodName, String enumClassName, String enumValueName)
obj
- The object on which to invoke the method.methodName
- The name of the method.public static Object newInstance(Class clazz, Class[] types, Object[] values) throws NoSuchMethodException, InstantiationException, IllegalAccessException, InvocationTargetException
clazz
- The Class on which to invoke the constructor.types
- The parameter types of the constructor.values
- The parameter values of the constructor.NoSuchMethodException
InstantiationException
IllegalAccessException
InvocationTargetException