You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cxf.apache.org by Benson Margulies <bi...@gmail.com> on 2010/10/11 13:55:39 UTC
Better type safety on proxy factory beans...
What do people think of enabling
JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
factory.setDataBinding(new AegisDatabinding());
// perhaps not needed given the endpointInterface annotation
factory.setServiceClass(DocumentDatabase.class);
factory.setAddress(serviceUrl);
return (DocumentDatabase) factory.create();
to change to
return factory.create(DocumentDatabase.class);
by way of a quick <T> on the method?
Re: Better type safety on proxy factory beans...
Posted by Daniel Kulp <dk...@apache.org>.
On Monday 11 October 2010 7:55:39 am Benson Margulies wrote:
> What do people think of enabling
>
> JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
> factory.setDataBinding(new AegisDatabinding());
> // perhaps not needed given the endpointInterface annotation
> factory.setServiceClass(DocumentDatabase.class);
> factory.setAddress(serviceUrl);
> return (DocumentDatabase) factory.create();
>
> to change to
>
> return factory.create(DocumentDatabase.class);
>
> by way of a quick <T> on the method?
I like the idea. Would it be something like:
<T> T create(Class<T> cls) {
this.setServiceClass(cls);
return cls.cast(create());
}
so you can then avoid the setServiceClass(..) call as well?
--
Daniel Kulp
dkulp@apache.org
http://dankulp.com/blog