/** * Adds a <code>BeanIntrospector</code>. This object is invoked when the * property descriptors of a class need to be obtained. * * @param introspector the <code>BeanIntrospector</code> to be added (must * not be <b>null</b> * @throws IllegalArgumentException if the argument is <b>null</b> * @since 1.9 */ public static void addBeanIntrospector(final BeanIntrospector introspector) { PropertyUtilsBean.getInstance().addBeanIntrospector(introspector); }
/** * Adds a <code>BeanIntrospector</code>. This object is invoked when the * property descriptors of a class need to be obtained. * * @param introspector the <code>BeanIntrospector</code> to be added (must * not be <b>null</b> * @throws IllegalArgumentException if the argument is <b>null</b> * @since 1.9 */ public static void addBeanIntrospector(final BeanIntrospector introspector) { PropertyUtilsBean.getInstance().addBeanIntrospector(introspector); }
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); }
/** * 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); }
/** * Adds a <code>BeanIntrospector</code>. This object is invoked when the * property descriptors of a class need to be obtained. * * @param introspector the <code>BeanIntrospector</code> to be added (must * not be <b>null</b> * @throws IllegalArgumentException if the argument is <b>null</b> * @since 1.9 */ public static void addBeanIntrospector(final BeanIntrospector introspector) { PropertyUtilsBean.getInstance().addBeanIntrospector(introspector); }
public BeanTypeListener() { // SHIRO-619 beanUtilsBean = new BeanUtilsBean(); beanUtilsBean.getPropertyUtils().addBeanIntrospector( SuppressPropertiesBeanIntrospector.SUPPRESS_CLASS); }
public DefaultTupleBuilder(TupleHandler tupleHandler) { builders = new HashMap<String, TupleBuilder<?, ?>>(); this.setHandler(tupleHandler); beanUtilsBean = new BeanUtilsBean(); beanUtilsBean.getPropertyUtils().addBeanIntrospector(SUPPRESS_CLASS); }
/** * 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 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); }
propertyUtilsBean.addBeanIntrospector(new FluentPropertyBeanIntrospector()); final BeanUtilsBean beanUtilsBean = new BeanUtilsBean(new EnumConvertUtilsBean(), propertyUtilsBean);
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); }
/** * BeanUtil initialization, considering Lutèce availables locales and date format properties */ public static void init( ) { mapBeanUtilsBeans = new HashMap<>( ); for ( Locale locale : I18nService.getAdminAvailableLocales( ) ) { BeanUtilsBean beanUtilsBean = new BeanUtilsBean( ); beanUtilsBean.getPropertyUtils( ).addBeanIntrospector( SuppressPropertiesBeanIntrospector.SUPPRESS_CLASS ); DateConverter dateConverter = new DateConverter( null ); dateConverter.setPattern( I18nService.getDateFormatShortPattern( locale ) ); beanUtilsBean.getConvertUtils( ).register( dateConverter, Date.class ); mapBeanUtilsBeans.put( locale.getLanguage( ), beanUtilsBean ); } }
/** * 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); } }