public final class MethodUtil extends Object
| Modifier and Type | Method and Description |
|---|---|
static <A> Method |
getGetter(A instance,
String strAttributeName,
Class<?> clazz)
Gets the setter.
|
static <A> Method |
getMethod(String strMethodPrefix,
A instance,
String strAttributeName,
Class<?> clazz)
Gets the method.
|
static <A> Method |
getPrimitiveMethod(String strMethodName,
A instance,
Class<?> clazz)
Gets the primitive method.
|
static <A> Method |
getSetter(A instance,
String strAttributeName,
Class<?> clazz)
Gets the setter.
|
static <A,B> void |
set(A instance,
String strAttributeName,
B value)
Sets the attribute.
|
public static <A,B> void set(A instance,
String strAttributeName,
B value)
throws NoSuchMethodException,
IllegalAccessException,
InvocationTargetException
A - the generic type of the instanceB - the generic type of the value to setinstance - the instance to setstrAttributeName - the attribute namevalue - the value of the attribute to setSecurityException - the security exceptionNoSuchMethodException - the no such method exceptionIllegalArgumentException - the illegal argument exceptionIllegalAccessException - the illegal access exceptionInvocationTargetException - the invocation target exceptionpublic static <A> Method getMethod(String strMethodPrefix, A instance, String strAttributeName, Class<?> clazz) throws NoSuchMethodException
A - the generic type of the instancestrMethodPrefix - the str method prefixinstance - the instancestrAttributeName - the str attribute nameclazz - the clazzSecurityException - the security exceptionNoSuchMethodException - the no such method exceptionpublic static <A> Method getPrimitiveMethod(String strMethodName, A instance, Class<?> clazz) throws NoSuchMethodException
A - the generic type of the instancestrMethodName - the str method nameinstance - the instanceclazz - the clazzSecurityException - the security exceptionNoSuchMethodException - the no such method exceptionpublic static <A> Method getSetter(A instance, String strAttributeName, Class<?> clazz) throws NoSuchMethodException
A - the generic typeinstance - the instancestrAttributeName - the str attribute nameclazz - the clazzSecurityException - the security exceptionNoSuchMethodException - the no such method exceptionpublic static <A> Method getGetter(A instance, String strAttributeName, Class<?> clazz) throws NoSuchMethodException
A - the generic type of the instanceinstance - the instancestrAttributeName - the str attribute nameclazz - the clazzSecurityException - the security exceptionNoSuchMethodException - the no such method exceptionCopyright © 2020 City of Paris. All rights reserved.