public static <P> P setData(P obj, Map<String, Object> data) throws Exception { synchronized (beanUtils) { beanUtils.populate(obj, data); } return obj; }
/** * <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>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); }
public static <P> P setData(URI uri, P obj, Map<String, String> query) throws Exception { synchronized (beanUtils) { beanUtils.setProperty(obj, "host", uri.getHost()); beanUtils.setProperty(obj, "port", uri.getPort()); beanUtils.setProperty(obj, "userInfo", uri.getUserInfo()); beanUtils.populate(obj, query); } return obj; }
public static <P> P setData(P obj, Map<String, Object> data) throws Exception { synchronized (beanUtils) { beanUtils.populate(obj, data); } return obj; }
public static <P> P setData(P obj, Map<String, Object> data) throws Exception { synchronized (beanUtils) { beanUtils.populate(obj, data); } return obj; }
public static <P> P setData(P obj, Map<String, Object> data) throws Exception { synchronized (beanUtils) { beanUtils.populate(obj, data); } return obj; }
public void convert(FormBean formBean, Map<String, String> attributeMap) throws InvocationTargetException, IllegalAccessException { beanUtilsBean.populate(formBean, attributeMap); }
public void populate(Object bean, Map properties) throws IllegalAccessException, InvocationTargetException { super.populate(bean, properties); if ((bean == null) || (properties == null)) { return; } fixPage(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 * * @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#populate */ public static void populate(Object bean, Map properties) throws IllegalAccessException, InvocationTargetException { BeanUtilsBean.getInstance().populate(bean, properties); }
/** * <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 * * @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#populate */ public static void populate(Object bean, Map properties) throws IllegalAccessException, InvocationTargetException { BeanUtilsBean.getInstance().populate(bean, properties); }
/** * <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>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 * * @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#populate */ public static void populate(Object bean, Map properties) throws IllegalAccessException, InvocationTargetException { BeanUtilsBean.getInstance().populate(bean, properties); }
public static <P> P setData(URI uri, P obj, Map<String, String> query) throws Exception { synchronized (beanUtils) { beanUtils.setProperty(obj, "host", uri.getHost()); beanUtils.setProperty(obj, "port", uri.getPort()); beanUtils.setProperty(obj, "userInfo", uri.getUserInfo()); beanUtils.populate(obj, query); } return obj; }
public static <P> P setData(URI uri, P obj, Map<String, String> query) throws Exception { synchronized (beanUtils) { beanUtils.setProperty(obj, "host", uri.getHost()); beanUtils.setProperty(obj, "port", uri.getPort()); beanUtils.setProperty(obj, "userInfo", uri.getUserInfo()); beanUtils.populate(obj, query); } return obj; }
public static <P> P setData(URI uri, P obj, Map<String, String> query) throws Exception { synchronized (beanUtils) { beanUtils.setProperty(obj, "host", uri.getHost()); beanUtils.setProperty(obj, "port", uri.getPort()); beanUtils.setProperty(obj, "userInfo", uri.getUserInfo()); beanUtils.populate(obj, query); } return obj; }
/** * Instantiates an object of the specified type and populates properties of the object from the provided * parameters. * * @param parameters a {@link Map} of values to populate the object from * @param cls the {@link Class} representing the type of the object to instantiate and populate * @param <T> the type of the object to instantiate and populate * @return the instantiated and populated object */ public static <T> T mapParametersToBean(Map<String, Object> parameters, Class<T> cls) { try { T bean = cls.newInstance(); BeanUtilsBean beanUtils = new BeanUtilsBean(); beanUtils.getPropertyUtils().addBeanIntrospector(SuppressPropertiesBeanIntrospector.SUPPRESS_CLASS); beanUtils.populate(bean, parameters); return bean; } catch (InstantiationException | IllegalAccessException | InvocationTargetException e) { throw new IllegalArgumentException("Error mapping parameters to class of type " + cls.getName(), e); } } }
/** * Instantiates an object of the specified type and populates properties of the object from the provided * parameters. * * @param parameters a {@link Map} of values to populate the object from * @param cls the {@link Class} representing the type of the object to instantiate and populate * @param <T> the type of the object to instantiate and populate * @return the instantiated and populated object */ public static <T> T mapParametersToBean(Map<String, Object> parameters, Class<T> cls) { try { T bean = cls.newInstance(); BeanUtilsBean beanUtils = new BeanUtilsBean(); beanUtils.getPropertyUtils().addBeanIntrospector(SuppressPropertiesBeanIntrospector.SUPPRESS_CLASS); beanUtils.populate(bean, parameters); return bean; } catch (InstantiationException | IllegalAccessException | InvocationTargetException e) { throw new IllegalArgumentException("Error mapping parameters to class of type " + cls.getName(), e); } } }
public void Action1(){ BeanUtilsBean beanUtils = new BeanUtilsBean(); ConvertUtilsBean convertUtils = beanUtils.getConvertUtils(); DateTimeConverter dtConverter = new DateConverter(); dtConverter.setPatterns(dateFormats1); convertUtils.register(dtConverter, Date.class); ... beanUtils.populate(myBean1, hashMap1); }
/** * Instantiates an object of the specified type and populates properties of the object from the provided * parameters. * * @param parameters a {@link Map} of values to populate the object from * @param cls the {@link Class} representing the type of the object to instantiate and populate * @param <T> the type of the object to instantiate and populate * @return the instantiated and populated object */ public static <T> T mapParametersToBean(Map<String, Object> parameters, Class<T> cls) { try { T bean = cls.newInstance(); BeanUtilsBean beanUtils = new BeanUtilsBean(); beanUtils.getPropertyUtils().addBeanIntrospector(SuppressPropertiesBeanIntrospector.SUPPRESS_CLASS); beanUtils.populate(bean, parameters); return bean; } catch (InstantiationException e) { throw newIllegalArgumentException(cls, e); } catch (IllegalAccessException e) { throw newIllegalArgumentException(cls, e); } catch (InvocationTargetException e) { throw newIllegalArgumentException(cls, e); } }