Class BeanUtil


  • public final class BeanUtil
    extends Object
    Since:
    2.0.0
    • Method Detail

      • getPropertyType

        public static Class<?> getPropertyType​(Object bean,
                                               String propertyName)
      • getPropertyGenericType

        public static Class<?> getPropertyGenericType​(Class<?> beanClass,
                                                      String propertyName)
      • getValue

        public static <T> T getValue​(Object bean,
                                     String propertyName)
      • setValue

        public static void setValue​(Object bean,
                                    String propertyName,
                                    Object value)
      • isSettable

        public static boolean isSettable​(Object bean,
                                         String propertyName)
      • isGettable

        public static boolean isGettable​(Object bean,
                                         String propertyName)
      • visitAll

        public static <T> void visitAll​(Object bean,
                                        Consumer<T> visitor,
                                        Class<T> type)
      • hasChildren

        public static boolean hasChildren​(Object bean)
      • copyPropertiesOverNulls

        public static <T> void copyPropertiesOverNulls​(T target,
                                                       T source)
      • copyProperties

        public static <T> void copyProperties​(T target,
                                              T source)
      • clone

        public static <T> T clone​(T bean)
      • diff

        public static <T> String diff​(T bean1,
                                      T bean2)
      • getWriteMethod

        public static Method getWriteMethod​(Object bean,
                                            String propertyName)
        Gets a bean write method, with supports for fluent API (returning self).
        Parameters:
        bean - object
        propertyName - property name
        Returns:
        method, or null in no writable method is found