Package com.github.dozermapper.core.util
Class ReflectionUtils
- java.lang.Object
-
- com.github.dozermapper.core.util.ReflectionUtils
-
public final class ReflectionUtils extends Object
Internal class that provides a various reflection utilities(specific to Dozer requirements) used throughout the code base. Not intended for direct use by application code.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Class<?>determineGenericsType(Class<?> parentClazz, PropertyDescriptor propDescriptor)static Class<?>determineGenericsType(Class<?> clazz, Method method, boolean isReadMethod)static Class<?>determineGenericsType(Type type)static MethodfindAMethod(Class<?> clazz, String methodName, BeanContainer beanContainer)Find a method with concrete string representation of it's parametersstatic PropertyDescriptorfindPropertyDescriptor(Class<?> objectClass, String fieldName, HintContainer deepIndexHintContainer)static DeepHierarchyElement[]getDeepFieldHierarchy(Class<?> parentClass, String field, HintContainer deepIndexHintContainer)static FieldgetFieldFromBean(Class<?> clazz, String fieldName)static MethodgetMethod(Class<?> clazz, String methodName)static MethodgetMethod(Class<?> clazz, String name, Class<?>[] parameterTypes)static MethodgetMethod(Object obj, String methodName)static MethodgetNonStandardSetter(Class<?> clazz, String fieldName)Finds non-standard settersPropertyUtils.getPropertyDescriptors(java.lang.Class<?>)does not find.static PropertyDescriptor[]getPropertyDescriptors(Class<?> objectClass)static Objectinvoke(Method method, Object obj, Object[] args)static <T> TnewInstance(Class<T> clazz)
-
-
-
Method Detail
-
findPropertyDescriptor
public static PropertyDescriptor findPropertyDescriptor(Class<?> objectClass, String fieldName, HintContainer deepIndexHintContainer)
-
getDeepFieldHierarchy
public static DeepHierarchyElement[] getDeepFieldHierarchy(Class<?> parentClass, String field, HintContainer deepIndexHintContainer)
-
findAMethod
public static Method findAMethod(Class<?> clazz, String methodName, BeanContainer beanContainer) throws NoSuchMethodException
Find a method with concrete string representation of it's parameters- Parameters:
clazz- clazz to searchmethodName- name of method with representation of it's parametersbeanContainer- beanContainer instance- Returns:
- found method
- Throws:
NoSuchMethodException- if no method found
-
getPropertyDescriptors
public static PropertyDescriptor[] getPropertyDescriptors(Class<?> objectClass)
-
getMethod
public static Method getMethod(Class<?> clazz, String name, Class<?>[] parameterTypes) throws NoSuchMethodException
- Throws:
NoSuchMethodException
-
newInstance
public static <T> T newInstance(Class<T> clazz)
-
determineGenericsType
public static Class<?> determineGenericsType(Class<?> parentClazz, PropertyDescriptor propDescriptor)
-
determineGenericsType
public static Class<?> determineGenericsType(Class<?> clazz, Method method, boolean isReadMethod)
-
getNonStandardSetter
public static Method getNonStandardSetter(Class<?> clazz, String fieldName)
Finds non-standard settersPropertyUtils.getPropertyDescriptors(java.lang.Class<?>)does not find. The non-standard setters include:- Setters that return something instead of
void - Setters that take a wrapper argument (e.g. Boolean) when the field is of primitive type (e.g. boolean) - or the other way around.
- Parameters:
clazz- The class to find non-standard setters fromfieldName- The field to find a non-standard setter for- Returns:
- The non-standard setter or
null
- Setters that return something instead of
-
-