/** * <p>Constructs an instance using given conversion instances * and new {@link PropertyUtilsBean} instance.</p> * * @param convertUtilsBean use this <code>ConvertUtilsBean</code> * to perform conversions from one object to another * * @since 1.8.0 */ public BeanUtilsBean(final ConvertUtilsBean convertUtilsBean) { this(convertUtilsBean, new PropertyUtilsBean()); }
/** * <p>Constructs an instance using given conversion instances * and new {@link PropertyUtilsBean} instance.</p> * * @param convertUtilsBean use this <code>ConvertUtilsBean</code> * to perform conversions from one object to another * * @since 1.8.0 */ public BeanUtilsBean(final ConvertUtilsBean convertUtilsBean) { this(convertUtilsBean, new PropertyUtilsBean()); }
/** * <p>Constructs an instance using new property * and conversion instances.</p> */ public BeanUtilsBean() { this(new ConvertUtilsBean(), new PropertyUtilsBean()); }
/** * <p>Constructs an instance using new property * and conversion instances.</p> */ public BeanUtilsBean() { this(new ConvertUtilsBean(), new PropertyUtilsBean()); }
/** * Creates a BeanUtilsBean that is configured to use * type converters that throw a ConversionException * instead of using the default value when something * goes wrong. * * @return a configured BeanUtilsBean */ private static BeanUtilsBean createBeanUtilsBean() { final ConvertUtilsBean cub = new ConvertUtilsBean(); registerIntegralTypes(cub); registerCustomTypes(cub); return new BeanUtilsBean(cub, new PropertyUtilsBean()); }
public static Map<String, Object> toMap(Object obj) { Map<String, Object> params = new HashMap<String, Object>(0); try { PropertyUtilsBean propertyUtilsBean = new PropertyUtilsBean(); PropertyDescriptor[] descriptors = propertyUtilsBean.getPropertyDescriptors(obj); for (int i = 0; i < descriptors.length; i++) { String name = descriptors[i].getName(); if (!"class".equals(name)) { params.put(name, propertyUtilsBean.getNestedProperty(obj, name)); } } } catch (Exception e) { e.printStackTrace(); } return params; }
/** * Initializes the shared {@code BeanUtilsBean} instance. This method sets * up custom bean introspection in a way that fluent parameter interfaces * are supported. * * @return the {@code BeanUtilsBean} instance to be used for all property * set operations */ private static BeanUtilsBean initBeanUtilsBean() { final PropertyUtilsBean propUtilsBean = new PropertyUtilsBean(); propUtilsBean.addBeanIntrospector(new FluentPropertyBeanIntrospector()); return new BeanUtilsBean(new ConvertUtilsBean(), propUtilsBean); }
/** * <p>Constructs an instance using given conversion instances * and new {@link PropertyUtilsBean} instance.</p> * * @param convertUtilsBean use this <code>ConvertUtilsBean</code> * to perform conversions from one object to another * * @since 1.8.0 */ public BeanUtilsBean(ConvertUtilsBean convertUtilsBean) { this(convertUtilsBean, new PropertyUtilsBean()); }
/** * <p>Constructs an instance using given conversion instances * and new {@link PropertyUtilsBean} instance.</p> * * @param convertUtilsBean use this <code>ConvertUtilsBean</code> * to perform conversions from one object to another * * @since 1.8.0 */ public BeanUtilsBean(ConvertUtilsBean convertUtilsBean) { this(convertUtilsBean, new PropertyUtilsBean()); }
/** * <p>Constructs an instance using given conversion instances * and new {@link PropertyUtilsBean} instance.</p> * * @param convertUtilsBean use this <code>ConvertUtilsBean</code> * to perform conversions from one object to another * * @since 1.8.0 */ public BeanUtilsBean(final ConvertUtilsBean convertUtilsBean) { this(convertUtilsBean, new PropertyUtilsBean()); }
/** * <p>Constructs an instance using given conversion instances * and new {@link PropertyUtilsBean} instance.</p> * * @param convertUtilsBean use this <code>ConvertUtilsBean</code> * to perform conversions from one object to another * * @since 1.8.0 */ public BeanUtilsBean(ConvertUtilsBean convertUtilsBean) { this(convertUtilsBean, new PropertyUtilsBean()); }
@Inject public Map2BeanTransformer(ComponentProvider componentProvider, TypeMapping mapping, PreConfiguredBeanUtils beanUtils, BeanTypeResolver beanTypeResolver) { this.componentProvider = componentProvider; this.mapping = mapping; this.beanUtils = beanUtils; this.beanTypeResolver = beanTypeResolver; this.propertyUtils = new PropertyUtilsBean(); }
/** * <p>Constructs an instance using new property * and conversion instances.</p> */ public BeanUtilsBean() { this(new ConvertUtilsBean(), new PropertyUtilsBean()); }
/** * <p>Constructs an instance using new property * and conversion instances.</p> */ public BeanUtilsBean() { this(new ConvertUtilsBean(), new PropertyUtilsBean()); }
/** * <p>Constructs an instance using new property * and conversion instances.</p> */ public BeanUtilsBean() { this(new ConvertUtilsBean(), new PropertyUtilsBean()); }
/** * <p>Constructs an instance using new property * and conversion instances.</p> */ public BeanUtilsBean() { this(new ConvertUtilsBean(), new PropertyUtilsBean()); }
public Content2BeanTransformerImpl() { super(); // We use non-static BeanUtils conversion, so we can // * use our custom ConvertUtilsBean // * control converters (convertUtilsBean.register()) - we can register them here, locally, as opposed to a // global ConvertUtils.register() final EnumAwareConvertUtilsBean convertUtilsBean = new EnumAwareConvertUtilsBean(); // de-register the converter for Class, we do our own conversion in convertPropertyValue() convertUtilsBean.deregister(Class.class); this.beanUtilsBean = new BeanUtilsBean(convertUtilsBean, new PropertyUtilsBean()); }
/** * Creates a BeanUtilsBean that is configured to use * type converters that throw a ConversionException * instead of using the default value when something * goes wrong. * * @return a configured BeanUtilsBean */ private static BeanUtilsBean createBeanUtilsBean() { final ConvertUtilsBean cub = new ConvertUtilsBean(); registerIntegralTypes(cub); registerCustomTypes(cub); return new BeanUtilsBean(cub, new PropertyUtilsBean()); }
ConvertUtilsBean convertUtilsBean = new ConvertUtilsBean(); convertUtilsBean.deregister(DateTime.class); convertUtilsBean.register(new JodaDateTimeConverter(), DateTime.class); BeanUtilsBean beanUtilsBean = new BeanUtilsBean(convertUtilsBean, new PropertyUtilsBean()); try { beanUtilsBean.setProperty(machineInfo, qName, temp); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); }
private static void prepare(){ //使用自定义的替换 BeanUtilsBean beanUtilsBean = new BeanUtilsBean(new CustConvertUtilsBean(),new PropertyUtilsBean()); BeanUtilsBean.setInstance(beanUtilsBean); //注册转换器,处理日期 registDateConvert(); //注册转换器,处理枚举 registEnumConvert(); }