/** * <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>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); }
beanUtils.copyProperty(this, key, value);
getPropertyUtils().isWriteable(dest, name)) { final Object value = ((DynaBean) orig).get(name); copyProperty(dest, name, value); final String name = entry.getKey(); if (getPropertyUtils().isWriteable(dest, name)) { copyProperty(dest, name, entry.getValue()); final Object value = getPropertyUtils().getSimpleProperty(orig, name); copyProperty(dest, name, value); } catch (final NoSuchMethodException e) {
getPropertyUtils().isWriteable(dest, name)) { final Object value = ((DynaBean) orig).get(name); copyProperty(dest, name, value); final String name = entry.getKey(); if (getPropertyUtils().isWriteable(dest, name)) { copyProperty(dest, name, entry.getValue()); final Object value = getPropertyUtils().getSimpleProperty(orig, name); copyProperty(dest, name, value); } catch (final NoSuchMethodException e) {
@Override public void copyProperty(Object bean, String name, Object value) throws IllegalAccessException, InvocationTargetException { if (null != value) { super.copyProperty(bean, name, value); } } }
@Override public void copyProperty(Object bean, String name, Object value) throws IllegalAccessException, InvocationTargetException { if (null != value) { super.copyProperty(bean, name, value); } } }
@Override public void copyProperty(Object dest, String name, Object value) throws IllegalAccessException, InvocationTargetException { if (value != null) { super.copyProperty(dest, name, value); } } }.copyProperties(dest, source);
@Override public void copyProperty(Object bean, String name, Object value) throws IllegalAccessException, InvocationTargetException { if (value == null) { return; } super.copyProperty(bean, name, value); } }
@Override public void copyProperty(Object dest, String name, Object value) throws IllegalAccessException, InvocationTargetException { try { if (PropertyUtils.getProperty(dest, name) != null) { return; } } catch (NoSuchMethodException e) { throw new InvocationTargetException(e, "Could not get property '" + name + "' for " + dest); } super.copyProperty(dest, name, value); }
/** * <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 * * @exception IllegalAccessException if the caller does not have * access to the property accessor method * @exception InvocationTargetException if the property accessor method * throws an exception * @see BeanUtilsBean#copyProperty */ public static void copyProperty(Object bean, String name, Object value) throws IllegalAccessException, InvocationTargetException { BeanUtilsBean.getInstance().copyProperty(bean, name, value); }
/** * <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 * * @exception IllegalAccessException if the caller does not have * access to the property accessor method * @exception InvocationTargetException if the property accessor method * throws an exception * @see BeanUtilsBean#copyProperty */ public static void copyProperty(Object bean, String name, Object value) throws IllegalAccessException, InvocationTargetException { BeanUtilsBean.getInstance().copyProperty(bean, name, value); }
/** * <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>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 * * @exception IllegalAccessException if the caller does not have * access to the property accessor method * @exception InvocationTargetException if the property accessor method * throws an exception * @see BeanUtilsBean#copyProperty */ public static void copyProperty(Object bean, String name, Object value) throws IllegalAccessException, InvocationTargetException { BeanUtilsBean.getInstance().copyProperty(bean, name, value); }
@Override public void copyProperty(Object dest, String name, Object value) throws IllegalAccessException, InvocationTargetException { try { Object exValue = this.getPropertyUtils().getProperty(dest, name); if(exValue == null) super.copyProperty(dest, name, value); } catch(NoSuchMethodException e) { // nothing to do either, just return } } }
public static void copyProperties(BeanUtilsBean beanUtilsBean, Object bean, Map properties) { if (bean == null || properties == null) { return; } for (Iterator itr = properties.keySet().iterator(); itr.hasNext();) { String name = (String) itr.next(); if (name == null) { continue; } if (beanUtilsBean.getPropertyUtils().isWriteable(bean, name)) { try { beanUtilsBean .copyProperty(bean, name, properties.get(name)); } catch (Throwable t) { if (logger_.isDebugEnabled()) { logger_.debug("Can't copy property '" + name + "'", t); } } } } } }
BeanUtilsBean.getInstance().copyProperty(dest, name, value);
BeanUtilsBean.getInstance().copyProperty(dest, name, value);
/** * Copy value to property. New instance of value will be created if * propertyType is {@link java.util.List}, {@link java.util.Set} or * {@link java.util.Map}. * * Note: ArrayList, HashSet and HashMap are being used to create new * instance of Collection, which will potential be an issue if propertyType * is not one of those implementation but sharing the same interface. */ private static void copyProperty(BeanUtilsBean beanUtilsBean, Object toBean, String property, Object value) throws InvocationTargetException, IllegalAccessException, NoSuchMethodException { Class<?> propertyType = beanUtilsBean.getPropertyUtils() .getPropertyDescriptor(toBean, property).getPropertyType(); if (isCollectionType(propertyType)) { value = createNewCollection(propertyType, value); } beanUtilsBean.copyProperty(toBean, property, value); }
public Object convert(Class type, Object value) { try { LazyDynaMap dynaMap = new LazyDynaMap((Map<String, Object>) value); WrapDynaBean bean = (WrapDynaBean) WrapDynaClass.createDynaClass(type).newInstance(); beanUtils.copyProperties(bean, dynaMap); beanUtils.copyProperty(bean, "", value); return bean.getInstance(); } catch (Exception e) { throw new UnhandledException(e); } } }