List of usage examples for org.apache.commons.beanutils FluentPropertyBeanIntrospector FluentPropertyBeanIntrospector
public FluentPropertyBeanIntrospector()
FluentPropertyBeanIntrospector and sets the default prefix for write methods. From source file:io.mandrel.common.querydsl.DslParser.java
public static LinkFilter parseLinkFilter(String input) { PropertyUtils.addBeanIntrospector(new FluentPropertyBeanIntrospector()); LinkFilterDslParser parser = Parboiled.createParser(LinkFilterDslParser.class); ParsingResult<LinkFilter> result = new RecoveringParseRunner<LinkFilter>(parser.Root()).run(input); if (result.hasErrors()) { throw new MandrelParseException("\nParse Errors:\n" + ErrorUtils.printParseErrors(result)); }//from ww w.j av a 2 s . c o m return result.parseTreeRoot.getValue(); }
From source file:org.jboss.bus.internal.ObjectFactory.java
/** * Sets the attributes of an object according to the properties provided. * * @param object Object on which the properties should be set. * @param properties Properties that should be set as properties of the object. Key is a name of an object property and value is its value. * @throws InvocationTargetException When it was not possible to call the setter on the object. * @throws IllegalAccessException When we did not have the correct rights to set any of the properties. *//*from w ww. ja va2 s . c om*/ public static void setPropertiesOnObject(final Object object, final Properties properties) throws IllegalAccessException, InvocationTargetException { final PropertyUtilsBean propertyUtilsBean = new PropertyUtilsBean(); propertyUtilsBean.addBeanIntrospector(new FluentPropertyBeanIntrospector()); final BeanUtilsBean beanUtilsBean = new BeanUtilsBean(new EnumConvertUtilsBean(), propertyUtilsBean); if (log.isTraceEnabled()) { log.trace(String.format("Setting properties on an instance of %s.", object.getClass().getName())); } for (final Map.Entry<Object, Object> entry : properties.entrySet()) { if (log.isTraceEnabled()) { log.trace("Setting property: '" + entry.getKey().toString() + "'='" + entry.getValue().toString() + "'"); } boolean successSet = false; // did we manage to set the property value? if (entry.getValue() instanceof Element) { // first, is it an XML element? try to set it... successSet = setElementProperty(object, entry.getKey().toString(), (Element) entry.getValue()); } if (!successSet) { // not yet set - either it was not an XML element or it failed with it beanUtilsBean.setProperty(object, entry.getKey().toString(), entry.getValue()); } } }