Skip to content

Instantly share code, notes, and snippets.

@clebertsuconic
Created December 15, 2014 18:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save clebertsuconic/be31b2789e7271db002b to your computer and use it in GitHub Desktop.
Save clebertsuconic/be31b2789e7271db002b to your computer and use it in GitHub Desktop.
private static final BeanUtilsBean2 beanUtils = new BeanUtilsBean2();
static
{
// This is to customize the BeanUtils to use Fluent Proeprties as well
beanUtils.getPropertyUtils().addBeanIntrospector(new FluentPropertyBeanIntrospector());
}
public T setData(URI uri, T obj) throws Exception
{
obj.setHost(uri.getHost());
obj.setPort(uri.getPort());
obj.setUserInfo(uri.getUserInfo());
synchronized (beanUtils)
{
beanUtils.populate(obj, parseQuery(uri.getQuery()));
}
return obj;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment