protected void setObjectPropertyNull(Object obj, Set<String> fields) { if (null == obj) { return; } for (String field : fields) { try { BeanUtilsBean.getInstance().getPropertyUtils().setProperty(obj, field, null); } catch (Exception ignore) { } } } }
/** * Convenience method to retrieve the {@link DynaProperty}s * for this {@link DynaClass}. * * @return The an array of the {@link DynaProperty}s. */ private DynaProperty[] getDynaProperties() { return getDynaBean().getDynaClass().getDynaProperties(); }
/** * Sets the method that should be used to write the property value. * * @param mappedSetter The mapped setter method. * @throws IntrospectionException If an error occurs finding the * mapped property */ public void setMappedWriteMethod(final Method mappedSetter) throws IntrospectionException { mappedWriteMethodRef = new MappedMethodReference(mappedSetter); findMappedPropertyType(); }
public BeanTypeListener() { // SHIRO-619 beanUtilsBean = new BeanUtilsBean(); beanUtilsBean.getPropertyUtils().addBeanIntrospector( SuppressPropertiesBeanIntrospector.SUPPRESS_CLASS); }
/** * Indicate whether the {@link DynaBean} contains a specified * value for one (or more) of its properties. * * @param key The {@link DynaBean}'s property name * @return <code>true</code> if one of the {@link DynaBean}'s * properties contains a specified value. */ public boolean containsKey(final Object key) { final DynaClass dynaClass = getDynaBean().getDynaClass(); final DynaProperty dynaProperty = dynaClass.getDynaProperty(toString(key)); return (dynaProperty == null ? false : true); }
public static void registerConverter(Converter converter, Class type) { synchronized (beanUtils) { beanUtils.getConvertUtils().register(converter, type); } }
/** * <p>Constructs an instance using new property * and conversion instances.</p> */ public BeanUtilsBean() { this(new ConvertUtilsBean(), new PropertyUtilsBean()); }
@Initializer public static void init() { Stapler.CONVERT_UTILS.register(new Converter() { public Object convert(Class type, Object value) { return Result.fromString(value.toString()); } }, Result.class); } }
/** * <p>Convert the value to an object of the specified class (if * possible).</p> * * @param value Value to be converted (may be null) * @param type Class of the value to be converted to * @return The converted value */ @Override protected Object convert(final Object value, final Class<?> type) { return getConvertUtils().convert(value, type); } }
/** * Return the value for the specified key from * the decorated {@link DynaBean}. * * @param key The {@link DynaBean}'s property name * @return The value for the specified property. */ public Object get(final Object key) { return getDynaBean().get(toString(key)); }
/** Construct a bean with standard converters registered */ public ConvertUtilsBean() { converters.setFast(false); deregister(); converters.setFast(true); }
/** * {@inheritDoc} This implementation removes all properties from the given context it * is configured for. */ public void introspect(final IntrospectionContext icontext) throws IntrospectionException { for (final String property : getSuppressedProperties()) { icontext.removePropertyDescriptor(property); } } }
/** * Convenience method to retrieve the {@link DynaProperty}s * for this {@link DynaClass}. * * @return The an array of the {@link DynaProperty}s. */ private DynaProperty[] getDynaProperties() { return getDynaBean().getDynaClass().getDynaProperties(); }
/** * <p>Constructs an instance using new property * and conversion instances.</p> */ public BeanUtilsBean() { this(new ConvertUtilsBean(), new PropertyUtilsBean()); }
@Override public void register(Converter converter, Class<?> clazz) { super.register(converter, clazz); if (converter != null) { registerCount++; } }
/** * Return the value for the specified key from * the decorated {@link DynaBean}. * * @param key The {@link DynaBean}'s property name * @return The value for the specified property. */ public Object get(final Object key) { return getDynaBean().get(toString(key)); }
/** * Sets the method that should be used to read one of the property value. * * @param mappedGetter The mapped getter method. * @throws IntrospectionException If an error occurs finding the * mapped property */ public void setMappedReadMethod(final Method mappedGetter) throws IntrospectionException { mappedReadMethodRef = new MappedMethodReference(mappedGetter); findMappedPropertyType(); }
/** * Sets the method that should be used to read one of the property value. * * @param mappedGetter The mapped getter method. * @throws IntrospectionException If an error occurs finding the * mapped property */ public void setMappedReadMethod(final Method mappedGetter) throws IntrospectionException { mappedReadMethodRef = new MappedMethodReference(mappedGetter); findMappedPropertyType(); }