@Override public void wrapper(ColumnMetadata instance, int index, String attr, Object value) { try { BeanUtilsBean.getInstance().setProperty(instance, attr, value); } catch (Exception e) { e.printStackTrace(); } }
protected boolean propertyInScope(Object obj, String property, Set<Object> scope) { if (null == obj) { return false; } try { Object value = BeanUtilsBean.getInstance().getProperty(obj, property); if (null != value) { return scope.contains(value); } } catch (Exception ignore) { logger.warn("can not get property {} from {},{}", property, obj, ignore.getMessage()); } return true; }
/** * Return the PropertyUtils bean instance. * @return The PropertyUtils bean instance */ protected static PropertyUtilsBean getInstance() { return BeanUtilsBean.getInstance().getPropertyUtils(); }
/** * If we're running on JDK 1.4 or later, initialize the cause for the given throwable. * * @param throwable The throwable. * @param cause The cause of the throwable. * @return true if the cause was initialized, otherwise false. * @since 1.8.0 */ public static boolean initCause(final Throwable throwable, final Throwable cause) { return BeanUtilsBean.getInstance().initCause(throwable, cause); }
/** * Get singleton instance * @return The singleton instance */ protected static ConvertUtilsBean getInstance() { return BeanUtilsBean.getInstance().getConvertUtils(); }
/** * If we're running on JDK 1.4 or later, initialize the cause for the given throwable. * * @param throwable The throwable. * @param cause The cause of the throwable. * @return true if the cause was initialized, otherwise false. * @since 1.8.0 */ public static boolean initCause(final Throwable throwable, final Throwable cause) { return BeanUtilsBean.getInstance().initCause(throwable, cause); }
/** * Get singleton instance * @return The singleton instance */ protected static ConvertUtilsBean getInstance() { return BeanUtilsBean.getInstance().getConvertUtils(); }
/** * Return the PropertyUtils bean instance. * @return The PropertyUtils bean instance */ protected static PropertyUtilsBean getInstance() { return BeanUtilsBean.getInstance().getPropertyUtils(); }
/** * <p>Copy the specified property value to the specified destination bean, * performing any type conversion that is required.</p> * * <p>For more details see <code>BeanUtilsBean</code>.</p> * * @param bean Bean on which setting is to be performed * @param name Property name (can be nested/indexed/mapped/combo) * @param value Value to be set * * @throws IllegalAccessException if the caller does not have * access to the property accessor method * @throws InvocationTargetException if the property accessor method * throws an exception * @see BeanUtilsBean#copyProperty */ public static void copyProperty(final Object bean, final String name, final Object value) throws IllegalAccessException, InvocationTargetException { BeanUtilsBean.getInstance().copyProperty(bean, name, value); }
/** * <p>Return the entire set of properties for which the specified bean * provides a read method.</p> * * <p>For more details see <code>BeanUtilsBean</code>.</p> * * @param bean Bean whose properties are to be extracted * @return Map of property descriptors * * @throws IllegalAccessException if the caller does not have * access to the property accessor method * @throws InvocationTargetException if the property accessor method * throws an exception * @throws NoSuchMethodException if an accessor method for this * property cannot be found * @see BeanUtilsBean#describe */ public static Map<String, String> describe(final Object bean) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException { return BeanUtilsBean.getInstance().describe(bean); }
/** * <p>Populate the JavaBeans properties of the specified bean, based on * the specified name/value pairs.</p> * * <p>For more details see <code>BeanUtilsBean</code>.</p> * * @param bean JavaBean whose properties are being populated * @param properties Map keyed by property name, with the * corresponding (String or String[]) value(s) to be set * * @throws IllegalAccessException if the caller does not have * access to the property accessor method * @throws InvocationTargetException if the property accessor method * throws an exception * @see BeanUtilsBean#populate */ public static void populate(final Object bean, final Map<String, ? extends Object> properties) throws IllegalAccessException, InvocationTargetException { BeanUtilsBean.getInstance().populate(bean, properties); }
/** * <p>Set the specified property value, performing type conversions as * required to conform to the type of the destination property.</p> * * <p>For more details see <code>BeanUtilsBean</code>.</p> * * @param bean Bean on which setting is to be performed * @param name Property name (can be nested/indexed/mapped/combo) * @param value Value to be set * * @throws IllegalAccessException if the caller does not have * access to the property accessor method * @throws InvocationTargetException if the property accessor method * throws an exception * @see BeanUtilsBean#setProperty */ public static void setProperty(final Object bean, final String name, final Object value) throws IllegalAccessException, InvocationTargetException { BeanUtilsBean.getInstance().setProperty(bean, name, value); }
/** * <p>Set the specified property value, performing type conversions as * required to conform to the type of the destination property.</p> * * <p>For more details see <code>BeanUtilsBean</code>.</p> * * @param bean Bean on which setting is to be performed * @param name Property name (can be nested/indexed/mapped/combo) * @param value Value to be set * * @throws IllegalAccessException if the caller does not have * access to the property accessor method * @throws InvocationTargetException if the property accessor method * throws an exception * @see BeanUtilsBean#setProperty */ public static void setProperty(final Object bean, final String name, final Object value) throws IllegalAccessException, InvocationTargetException { BeanUtilsBean.getInstance().setProperty(bean, name, value); }
/** * <p>Return the value of the specified indexed property of the specified * bean, as a String.</p> * * <p>For more details see <code>BeanUtilsBean</code>.</p> * * @param bean Bean whose property is to be extracted * @param name <code>propertyname[index]</code> of the property value * to be extracted * @return The indexed property's value, converted to a String * * @throws IllegalAccessException if the caller does not have * access to the property accessor method * @throws InvocationTargetException if the property accessor method * throws an exception * @throws NoSuchMethodException if an accessor method for this * property cannot be found * @see BeanUtilsBean#getIndexedProperty(Object, String) */ public static String getIndexedProperty(final Object bean, final String name) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException { return BeanUtilsBean.getInstance().getIndexedProperty(bean, name); }
/** * <p>Copy the specified property value to the specified destination bean, * performing any type conversion that is required.</p> * * <p>For more details see <code>BeanUtilsBean</code>.</p> * * @param bean Bean on which setting is to be performed * @param name Property name (can be nested/indexed/mapped/combo) * @param value Value to be set * * @throws IllegalAccessException if the caller does not have * access to the property accessor method * @throws InvocationTargetException if the property accessor method * throws an exception * @see BeanUtilsBean#copyProperty */ public static void copyProperty(final Object bean, final String name, final Object value) throws IllegalAccessException, InvocationTargetException { BeanUtilsBean.getInstance().copyProperty(bean, name, value); }
/** * <p>Populate the JavaBeans properties of the specified bean, based on * the specified name/value pairs.</p> * * <p>For more details see <code>BeanUtilsBean</code>.</p> * * @param bean JavaBean whose properties are being populated * @param properties Map keyed by property name, with the * corresponding (String or String[]) value(s) to be set * * @throws IllegalAccessException if the caller does not have * access to the property accessor method * @throws InvocationTargetException if the property accessor method * throws an exception * @see BeanUtilsBean#populate */ public static void populate(final Object bean, final Map<String, ? extends Object> properties) throws IllegalAccessException, InvocationTargetException { BeanUtilsBean.getInstance().populate(bean, properties); }
/** * <p>Return the value of the specified array property of the specified * bean, as a String array.</p> * * <p>For more details see <code>BeanUtilsBean</code>.</p> * * @param bean Bean whose property is to be extracted * @param name Name of the property to be extracted * @return The array property value * * @throws IllegalAccessException if the caller does not have * access to the property accessor method * @throws InvocationTargetException if the property accessor method * throws an exception * @throws NoSuchMethodException if an accessor method for this * property cannot be found * @see BeanUtilsBean#getArrayProperty */ public static String[] getArrayProperty(final Object bean, final String name) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException { return BeanUtilsBean.getInstance().getArrayProperty(bean, name); }
/** * <p>Return the value of the specified simple property of the specified * bean, converted to a String.</p> * * <p>For more details see <code>BeanUtilsBean</code>.</p> * * @param bean Bean whose property is to be extracted * @param name Name of the property to be extracted * @return The property's value, converted to a String * * @throws IllegalAccessException if the caller does not have * access to the property accessor method * @throws InvocationTargetException if the property accessor method * throws an exception * @throws NoSuchMethodException if an accessor method for this * property cannot be found * @see BeanUtilsBean#getSimpleProperty */ public static String getSimpleProperty(final Object bean, final String name) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException { return BeanUtilsBean.getInstance().getSimpleProperty(bean, name); }
/** * Return the value of the specified indexed property of the specified * bean, as a String. The index is specified as a method parameter and * must *not* be included in the property name expression * * <p>For more details see <code>BeanUtilsBean</code>.</p> * * @param bean Bean whose property is to be extracted * @param name Simple property name of the property value to be extracted * @param index Index of the property value to be extracted * @return The indexed property's value, converted to a String * * @throws IllegalAccessException if the caller does not have * access to the property accessor method * @throws InvocationTargetException if the property accessor method * throws an exception * @throws NoSuchMethodException if an accessor method for this * property cannot be found * @see BeanUtilsBean#getIndexedProperty(Object, String, int) */ public static String getIndexedProperty(final Object bean, final String name, final int index) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException { return BeanUtilsBean.getInstance().getIndexedProperty(bean, name, index); }
protected void setObjectPropertyNull(Object obj, Set<String> fields) { if (null == obj) { return; } for (String field : fields) { try { BeanUtilsBean.getInstance().getPropertyUtils().setProperty(obj, field, null); } catch (Exception ignore) { } } } }