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) { } } } }
/** * <p>Set the value of the specified property of the specified bean, * no matter which property reference format is used, with no * type conversions.</p> * * <p>For more details see <code>PropertyUtilsBean</code>.</p> * * @param bean Bean whose property is to be modified * @param name Possibly indexed and/or nested name of the property * to be modified * @param value Value to which this property is to be set * * @throws IllegalAccessException if the caller does not have * access to the property accessor method * @throws IllegalArgumentException if <code>bean</code> or * <code>name</code> is null * @throws InvocationTargetException if the property accessor method * throws an exception * @throws NoSuchMethodException if an accessor method for this * propety cannot be found * @see PropertyUtilsBean#setProperty */ public static void setProperty(final Object bean, final String name, final Object value) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException { PropertyUtilsBean.getInstance().setProperty(bean, name, value); }
/** * <p>Set the value of the specified property of the specified bean, * no matter which property reference format is used, with no * type conversions.</p> * * <p>For more details see <code>PropertyUtilsBean</code>.</p> * * @param bean Bean whose property is to be modified * @param name Possibly indexed and/or nested name of the property * to be modified * @param value Value to which this property is to be set * * @throws IllegalAccessException if the caller does not have * access to the property accessor method * @throws IllegalArgumentException if <code>bean</code> or * <code>name</code> is null * @throws InvocationTargetException if the property accessor method * throws an exception * @throws NoSuchMethodException if an accessor method for this * propety cannot be found * @see PropertyUtilsBean#setProperty */ public static void setProperty(final Object bean, final String name, final Object value) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException { PropertyUtilsBean.getInstance().setProperty(bean, name, value); }
.setProperty(supportParam, field, null); } catch (Exception e) { logger.warn("can't set {} null", field, e);
getPropertyUtils().setProperty(target, propName, newValue);
getPropertyUtils().setProperty(target, propName, newValue);
getPropertyUtils().setProperty(target, name, newValue); } catch (final NoSuchMethodException e) { throw new InvocationTargetException
getPropertyUtils().setProperty(target, name, newValue); } catch (final NoSuchMethodException e) { throw new InvocationTargetException
public static synchronized void setProperty( Object dest, String p,Object value) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException { pb.setProperty(dest, p, value); }
/** * Update the Attribute * * @param beanUtils * @param attr The attribute to set. * @throws IllegalAccessException * @throws InvocationTargetException * @throws NoSuchMethodException */ public void updateAttribute(PropertyUtilsBean beanUtils, Attribute attr) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException { if (this.attribute != null && propertyDescriptor != null) { // update object value beanUtils.setProperty(bean, getName(), attr.getValue()); } this.attribute = attr; }
/** * <p>Set the value of the specified property of the specified bean, * no matter which property reference format is used, with no * type conversions.</p> * * <p>For more details see <code>PropertyUtilsBean</code>.</p> * * @param bean Bean whose property is to be modified * @param name Possibly indexed and/or nested name of the property * to be modified * @param value Value to which this property is to be set * * @throws IllegalAccessException if the caller does not have * access to the property accessor method * @throws IllegalArgumentException if <code>bean</code> or * <code>name</code> is null * @throws InvocationTargetException if the property accessor method * throws an exception * @throws NoSuchMethodException if an accessor method for this * propety cannot be found * @see PropertyUtilsBean#setProperty */ public static void setProperty(final Object bean, final String name, final Object value) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException { PropertyUtilsBean.getInstance().setProperty(bean, name, value); }
/** * <p>Set the value of the specified property of the specified bean, * no matter which property reference format is used, with no * type conversions.</p> * * <p>For more details see <code>PropertyUtilsBean</code>.</p> * * @param bean Bean whose property is to be modified * @param name Possibly indexed and/or nested name of the property * to be modified * @param value Value to which this property is to be set * * @exception IllegalAccessException if the caller does not have * access to the property accessor method * @exception IllegalArgumentException if <code>bean</code> or * <code>name</code> is null * @exception InvocationTargetException if the property accessor method * throws an exception * @exception NoSuchMethodException if an accessor method for this * propety cannot be found * @see PropertyUtilsBean#setProperty */ public static void setProperty(Object bean, String name, Object value) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException { PropertyUtilsBean.getInstance().setProperty(bean, name, value); }
/** * <p>Set the value of the specified property of the specified bean, * no matter which property reference format is used, with no * type conversions.</p> * * <p>For more details see <code>PropertyUtilsBean</code>.</p> * * @param bean Bean whose property is to be modified * @param name Possibly indexed and/or nested name of the property * to be modified * @param value Value to which this property is to be set * * @exception IllegalAccessException if the caller does not have * access to the property accessor method * @exception IllegalArgumentException if <code>bean</code> or * <code>name</code> is null * @exception InvocationTargetException if the property accessor method * throws an exception * @exception NoSuchMethodException if an accessor method for this * propety cannot be found * @see PropertyUtilsBean#setProperty */ public static void setProperty(Object bean, String name, Object value) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException { PropertyUtilsBean.getInstance().setProperty(bean, name, value); }
@Override public void wrapper(T instance, int index, String attr, Object value) { RDBColumnMetaData metaData = tableMetaData.findColumn(attr); if (metaData != null) { try { ValueConverter valueConverter = metaData.getValueConverter(); propertyUtil.setProperty(instance, attr, valueConverter.getValue(value)); } catch (NoSuchMethodException e) { } catch (Throwable e) { logger.warn("{}.setProperty('{}',{});error ", instance.getClass().getName(), attr, value, e); } } }
@Override public void wrapper(T instance, int index, String attr, Object value) { RDBColumnMetaData metaData = tableMetaData.findColumn(attr); if (metaData != null) { try { ValueConverter valueConverter = metaData.getValueConverter(); propertyUtil.setProperty(instance, attr, valueConverter.getValue(value)); } catch (NoSuchMethodException e) { } catch (Throwable e) { logger.warn("{}.setProperty('{}',{});error ", instance.getClass().getName(), attr, value, e); } } }
@Override public void wrapper(T instance, int index, String attr, Object value) { RDBColumnMetaData metaData = tableMetaData.findColumn(attr); if (metaData != null) { try { ValueConverter valueConverter = metaData.getValueConverter(); propertyUtil.setProperty(instance, attr, valueConverter.getValue(value)); } catch (NoSuchMethodException e) { } catch (Throwable e) { logger.warn("{}.setProperty('{}',{});error ", instance.getClass().getName(), attr, value, e); } } }
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) { } } } }
/** * 暴力设置对象变量赋值忽略private,protected修饰符的限制. * @throws NoSuchFieldException如果没有该Field时抛出 */ public static void forceSetProperty(Object object, String propertyName, Object newValue) throws NoSuchFieldException { try { BeanUtilsBean.getInstance().getPropertyUtils() .setProperty(object, propertyName, newValue); return; } catch (Exception e) { } Field field = getDeclaredField(object, propertyName); boolean accessible = field.isAccessible(); field.setAccessible(true); try { field.set(object, newValue); } catch (IllegalAccessException e) { logger.info("Error won't happen"); } field.setAccessible(accessible); }
public Update<T, Q> set(String property, Object value) { if (param.getData() == null) { ((UpdateParam) param).setData(new HashMap<>()); } if (param.getData() instanceof Map) { ((Map) param.getData()).put(property, value); } else { try { propertyUtilsBean.setProperty(param.getData(), property, value); } catch (Exception e) { logger.warn("set property error", e); } } return this; }
public Update<T, Q> set(String property, Object value) { if (param.getData() == null) { ((UpdateParam) param).setData(new HashMap<>()); } if (param.getData() instanceof Map) { ((Map) param.getData()).put(property, value); } else { try { propertyUtilsBean.setProperty(param.getData(), property, value); } catch (Exception e) { logger.warn("set property error", e); } } return this; }