Package org.bonitasoft.engine.commons
Class ClassReflector
java.lang.Object
org.bonitasoft.engine.commons.ClassReflector
- Author:
- Baptiste Mesta, Matthieu Chaffotte, Laurent Leseigneur
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidstatic Collection<Method>getAccessibleGetters(Class<?> clazz) static intstatic <T> Class<T>static MethodgetCompatibleMethod(Class<?> clazz, String methodName, Class<?>... paramTypes) static <T> Constructor<T>getConstructor(Class<T> clazz, Class<?>... parameterTypes) static <T> Constructor<T>getConstructor(Class<T> clazz, String className, Class<?>... parameterTypes) static Method[]getDeclaredGetters(Class<?> clazz) static Method[]getDeclaredSetters(Class<?> clazz) static StringgetFieldName(String methodName) static MethodgetFirstMethodWithName(Class<?> clazz, String methodName) static StringgetGetterName(String fieldName) static StringgetGetterName(String fieldName, Class<?> fieldType) static TypegetGetterReturnType(Class<?> classConnector, String getterName) static <T> TgetInstance(Constructor<T> constructor, Object... parameters) static Methodstatic MethodgetMethodByName(Class<?> clazz, String methodName) static <T> Tstatic <T> TinvokeGetter(Object entity, String getterName) static ObjectinvokeMethod(Object entity, String methodName, Class<?>[] parameterType, Object[] parameterValue) static ObjectinvokeMethod(Object entity, String methodName, Class<?> parameterType, Object parameterValue) static ObjectinvokeMethodByName(Object entity, String methodName, Object... parameterValues) static voidinvokeSetter(Object entity, String setterName, Class<?> parameterType, Object parameterValue) static booleanisAGetterMethod(Method method) static booleanisASetterMethod(Method method) static voidcall a setter by reflection support pointed notation like pojo.child.name
-
Constructor Details
-
ClassReflector
public ClassReflector()
-
-
Method Details
-
getAccessibleGetters
-
getClass
- Throws:
SReflectException
-
getObject
- Throws:
SReflectException
-
getConstructor
public static <T> Constructor<T> getConstructor(Class<T> clazz, Class<?>... parameterTypes) throws SReflectException - Throws:
SReflectException
-
getConstructor
public static <T> Constructor<T> getConstructor(Class<T> clazz, String className, Class<?>... parameterTypes) throws SReflectException - Throws:
SReflectException
-
getInstance
public static <T> T getInstance(Constructor<T> constructor, Object... parameters) throws SReflectException - Throws:
SReflectException
-
invokeGetter
- Throws:
SReflectException
-
invokeSetter
public static void invokeSetter(Object entity, String setterName, Class<?> parameterType, Object parameterValue) throws SReflectException - Throws:
SReflectException
-
getMethod
public static Method getMethod(Class<?> clazz, String methodName, Class<?>... parameterTypes) throws NoSuchMethodException - Throws:
NoSuchMethodException
-
getMethodByName
-
getFirstMethodWithName
-
invokeMethodByName
public static Object invokeMethodByName(Object entity, String methodName, Object... parameterValues) throws SReflectException - Throws:
SReflectException
-
invokeMethod
public static Object invokeMethod(Object entity, String methodName, Class<?> parameterType, Object parameterValue) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException, NoSuchMethodException -
invokeMethod
public static Object invokeMethod(Object entity, String methodName, Class<?>[] parameterType, Object[] parameterValue) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException, NoSuchMethodException -
getCompatibleMethod
public static Method getCompatibleMethod(Class<?> clazz, String methodName, Class<?>... paramTypes) throws SReflectException - Throws:
SReflectException
-
getGetterReturnType
public static Type getGetterReturnType(Class<?> classConnector, String getterName) throws SReflectException - Throws:
SReflectException
-
getDeclaredSetters
-
getDeclaredGetters
-
isAGetterMethod
-
isASetterMethod
-
getGetterName
-
getGetterName
-
getFieldName
-
setField
public static void setField(Object object, String fieldName, Object parameterValue) throws SReflectException call a setter by reflection support pointed notation like pojo.child.name- Parameters:
object- object on with to call the setterfieldName-parameterValue-- Throws:
SReflectException
-
clearCache
public static void clearCache() -
getCacheSize
public static int getCacheSize()
-