Class 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 Detail

      • 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 search
        methodName - name of method with representation of it's parameters
        beanContainer - beanContainer instance
        Returns:
        found method
        Throws:
        NoSuchMethodException - if no method found
      • getFieldFromBean

        public static Field getFieldFromBean​(Class<?> clazz,
                                             String fieldName)
      • newInstance

        public static <T> T newInstance​(Class<T> clazz)
      • determineGenericsType

        public static Class<?> determineGenericsType​(Class<?> clazz,
                                                     Method method,
                                                     boolean isReadMethod)
      • determineGenericsType

        public static Class<?> determineGenericsType​(Type type)
      • getNonStandardSetter

        public static Method getNonStandardSetter​(Class<?> clazz,
                                                  String fieldName)
        Finds non-standard setters PropertyUtils.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 from
        fieldName - The field to find a non-standard setter for
        Returns:
        The non-standard setter or null