@Override protected BeanUtilsBean initialValue() { return new BeanUtilsBean(); } };
@Override protected BeanUtilsBean initialValue() { return new BeanUtilsBean(); } };
public BeanTypeListener() { // SHIRO-619 beanUtilsBean = new BeanUtilsBean(); beanUtilsBean.getPropertyUtils().addBeanIntrospector( SuppressPropertiesBeanIntrospector.SUPPRESS_CLASS); }
public ReflectionBuilder(Map<String, ?> defaults) { // SHIRO-619 beanUtilsBean = new BeanUtilsBean(); beanUtilsBean.getPropertyUtils().addBeanIntrospector(SuppressPropertiesBeanIntrospector.SUPPRESS_CLASS); this.interpolator = createInterpolator(); this.objects = createDefaultObjectMap(); this.registeredEventSubscribers = new LinkedHashMap<String,Object>(); apply(defaults); }
/** * 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()); }
import org.apache.commons.beanutils.converters.IntegerConverter; IntegerConverter converter = new IntegerConverter(null); BeanUtilsBean beanUtilsBean = new BeanUtilsBean(); beanUtilsBean.getConvertUtils().register(converter, Integer.class);
/** * 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); }
public static void nullAwareBeanCopy(Object dest, Object source) throws IllegalAccessException, InvocationTargetException { new BeanUtilsBean() { @Override public void copyProperty(Object dest, String name, Object value) throws IllegalAccessException, InvocationTargetException { if(value != null) { super.copyProperty(dest, name, value); } } }.copyProperties(dest, source); }
public static void propertyHack(Object bean, String property, String nullreplace){ try{ return new BeanUtilsBean().getProperty(bean, property); } catch(NullPointerException npe){ return nullreplace; } }
@Override protected BeanUtilsBean initialValue() { return new BeanUtilsBean(); } };
BeanUtilsBean beanUtilsBean = new BeanUtilsBean(new ConvertUtilsBean() { @Override public Object convert(String value, Class clazz) { if (clazz.isEnum()){ return Enum.valueOf(clazz, value); }else{ return super.convert(value, clazz); } } });
/** * 复制bean,不过滤null属性 * @param from * @param to */ public static void copyPropertiesAllowNull(Object from,Object to){ copyProperties(from,to,new BeanUtilsBean()); }
/** * Constructor. */ public KinesisClientLibConfigurator() { this.convertUtilsBean = new ConvertUtilsBean(); this.utilsBean = new BeanUtilsBean(convertUtilsBean); this.configuration = new MultiLangDaemonConfiguration(utilsBean, convertUtilsBean); }
public BeanTypeListener() { // SHIRO-619 beanUtilsBean = new BeanUtilsBean(); beanUtilsBean.getPropertyUtils().addBeanIntrospector( SuppressPropertiesBeanIntrospector.SUPPRESS_CLASS); }
public static void initBeanUtils() { // begin Kuali Foundation modification ConvertUtilsBean convUtils = new ConvertUtilsBean(); PropertyUtilsBean propUtils = new PojoPropertyUtilsBean(); BeanUtilsBean pojoBeanUtils = new BeanUtilsBean(convUtils, propUtils); BeanUtilsBean.setInstance(pojoBeanUtils); logger.fine("Initialized BeanUtilsBean with " + pojoBeanUtils); // end Kuali Foundation modification }
public DefaultTupleBuilder(TupleHandler tupleHandler) { builders = new HashMap<String, TupleBuilder<?, ?>>(); this.setHandler(tupleHandler); beanUtilsBean = new BeanUtilsBean(); beanUtilsBean.getPropertyUtils().addBeanIntrospector(SUPPRESS_CLASS); }
public ImplicitMapEntryBuilder(String fieldName, Class<?> keyClass, Class<?> valueClass) { super(new DefaultScalarTupleHandler(fieldName)); this.fieldName = fieldName; this.keyClass = keyClass; this.valueClass = valueClass; beanUtilsBean = new BeanUtilsBean(); beanUtilsBean.getPropertyUtils().addBeanIntrospector(SUPPRESS_CLASS); }
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()); }
private static void checkEquals(Object factory, Object factory2) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException { BeanUtilsBean bean = new BeanUtilsBean(); PropertyDescriptor[] descriptors = bean.getPropertyUtils().getPropertyDescriptors(factory); for (PropertyDescriptor descriptor : descriptors) { if (descriptor.getWriteMethod() != null && descriptor.getReadMethod() != null) { Assert.assertEquals(descriptor.getName() + " incorrect", bean.getProperty(factory, descriptor.getName()), bean.getProperty(factory2, descriptor.getName())); } } }
public DefaultRequestProcessor() { ConvertUtilsBean convertUtilsBean = new ConvertUtilsBean(); convertUtilsBean.register(new FormFileConverter(), FormFile.class); convertUtilsBean.register(new FormFileArrayConverter(), FormFile[].class); beanUtilsBean_ = new BeanUtilsBean(convertUtilsBean, propertyUtilsBean_); DisposableUtil.add(new Disposable() { public void dispose() { propertyUtilsBean_.clearDescriptors(); } }); }