@Test public void testCopyProperty() throws InvocationTargetException, IllegalAccessException { BusinessLog bean1 = new BusinessLog(); bean1.setOperationName("operationName test"); bean1.setOperation_type("operationName type"); Log bean2 = new Log(); BeanUtil.copyProperty(bean1, bean2, new String[]{"operationName"}); System.out.println(bean2); Log bean3 = new Log(); BeanUtil.copyProperties(bean1, bean3); System.out.println(bean3); BeanUtil.copyPropertiesPeaceful(bean1, bean3); System.out.println(bean3); Log2 bean4 = new Log2(); BeanUtil.copyPropertiesIgnoreCase(bean1, bean4); System.out.println(bean4); BeanUtil.copyPropertiesIgnoreCasePeaceful(bean1, bean4); System.out.println(bean4); Log bean5 = new Log(); BeanUtil.copyPropertyPeaceful(bean1, bean5, new String[]{"operationName"}); System.out.println(bean4); }
public static void copyProperty(Object srcBean, Object destBean, String[] pros) throws InvocationTargetException, IllegalAccessException { add(srcBean); add(destBean); if (CheckUtil.valid(pros)) { for (String s : pros) { Object value = readMethod(srcBean, getReadMethod(srcBean, s)); writeMethod(destBean, getWriteMethod(destBean, s), value); } } }
BeanUtil { public static void copyProperty(Object srcBean, Object destBean, String[] pros) throws InvocationTargetException, IllegalAccessException { add(srcBean); add(destBean); if (CheckUtil.valid(pros)) { for (String s : pros) { Object value = readMethod(srcBean, getReadMethod(srcBean, s)); writeMethod(destBean, getWriteMethod(destBean, s), value); } } } }
BeanUtil { public static void copyProperty(Object srcBean, Object destBean, String[] pros) throws InvocationTargetException, IllegalAccessException { add(srcBean); add(destBean); if (CheckUtil.valid(pros)) { for (String s : pros) { Object value = readMethod(srcBean, getReadMethod(srcBean, s)); writeMethod(destBean, getWriteMethod(destBean, s), value); } } }  }
BeanUtil { public static void copyProperty(Object srcBean, Object destBean, String[] pros) throws InvocationTargetException, IllegalAccessException { add(srcBean); add(destBean); if (CheckUtil.valid(pros)) { for (String s : pros) { Object value = readMethod(srcBean, getReadMethod(srcBean, s)); writeMethod(destBean, getWriteMethod(destBean, s), value); } } }  static void add(Object obj); static void add(Class clazz); static boolean hasProperty(Object bean, String pro); static boolean hasDeclaredProperty(Object bean, String pro); static boolean hasPropertyIgnoreCase(Object bean, String pro); static boolean hasPropertyFilter(Object bean, String pro, PropertyFilter filter); static Object getProperty(Object bean, String pro); static Object getPropertyPeaceful(Object bean, String pro); static Object getPropertyIgnoreCase(Object bean,
                                               String pro); static Object getPropertyIgnoreCasePeaceful(Object bean, String pro); static Object getPropertyFilter(Object bean, String pro,
                                           PropertyFilter filter); static Object getPropertyFilterPeaceful(Object bean, String pro, PropertyFilter filter); static void setProperty(Object bean, String pro,
                                   Object value); static void setPropertyPeaceful(Object bean, String pro, Object value); static void setPropertyIgnoreCase(Object bean, String pro,
                                             Object value); static void setPropertyIgnoreCasePeaceful(Object bean, String pro, Object value); static void setPropertyFilter(Object bean, String pro, Object value,
                                         PropertyFilter filter); static void setPropertyFilterPeaceful(Object bean, String pro, Object value, PropertyFilter filter); static void copyProperty(Object srcBean, Object destBean,
                                    String[] pros); static void copyPropertyPeaceful(Object srcBean, Object destBean, String[] pros); static void copyProperties(Object srcBean,
                                      Object destBean); static void copyPropertiesPeaceful(Object srcBean, Object destBean); static void copyPropertiesIgnoreCase(Object srcBean,
                                                Object destBean); static void copyPropertiesIgnoreCasePeaceful(Object srcBean, Object destBean); static void copyProperties(Object srcBean, Object destBean,
                                      PropertyFilter filter); static void copyPropertiesPeaceful(Object srcBean, Object destBean, PropertyFilter filter); }
BeanUtil { public static void copyProperty(Object srcBean, Object destBean, String[] pros) throws InvocationTargetException, IllegalAccessException { add(srcBean); add(destBean); if (CheckUtil.valid(pros)) { for (String s : pros) { Object value = readMethod(srcBean, getReadMethod(srcBean, s)); writeMethod(destBean, getWriteMethod(destBean, s), value); } } }  static void add(Object obj); static void add(Class clazz); static boolean hasProperty(Object bean, String pro); static boolean hasDeclaredProperty(Object bean, String pro); static boolean hasPropertyIgnoreCase(Object bean, String pro); static boolean hasPropertyFilter(Object bean, String pro, PropertyFilter filter); static Object getProperty(Object bean, String pro); static Object getPropertyPeaceful(Object bean, String pro); static Object getPropertyIgnoreCase(Object bean,
                                               String pro); static Object getPropertyIgnoreCasePeaceful(Object bean, String pro); static Object getPropertyFilter(Object bean, String pro,
                                           PropertyFilter filter); static Object getPropertyFilterPeaceful(Object bean, String pro, PropertyFilter filter); static void setProperty(Object bean, String pro,
                                   Object value); static void setPropertyPeaceful(Object bean, String pro, Object value); static void setPropertyIgnoreCase(Object bean, String pro,
                                             Object value); static void setPropertyIgnoreCasePeaceful(Object bean, String pro, Object value); static void setPropertyFilter(Object bean, String pro, Object value,
                                         PropertyFilter filter); static void setPropertyFilterPeaceful(Object bean, String pro, Object value, PropertyFilter filter); static void copyProperty(Object srcBean, Object destBean,
                                    String[] pros); static void copyPropertyPeaceful(Object srcBean, Object destBean, String[] pros); static void copyProperties(Object srcBean,
                                      Object destBean); static void copyPropertiesPeaceful(Object srcBean, Object destBean); static void copyPropertiesIgnoreCase(Object srcBean,
                                                Object destBean); static void copyPropertiesIgnoreCasePeaceful(Object srcBean, Object destBean); static void copyProperties(Object srcBean, Object destBean,
                                      PropertyFilter filter); static void copyPropertiesPeaceful(Object srcBean, Object destBean, PropertyFilter filter);  }