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 2009/09/01 01:26:34 UTC
Seeming JAX-RS mistake
This can't work right for generic types (like collections), since it doesn't
use java.lang.reflect.Type.
public interface ContextResolver<T> {
/**
* Get a context of type <code>T</code> that is applicable to the
supplied
* type.
* @param type the class of object for which a context is desired
* @return a context for the supplied type or <code>null</code> if a
* context for the supplied type is not available from this provider.
*/
T getContext(Class<?> type);
}
Re: Seeming JAX-RS mistake
Posted by Sergey Beryozkin <sb...@progress.com>.
Hi Benson
This interface is meant to be used with types like JAXBContext or (JAXB) Marshaller, I think it was introduced to let users overcome the issues with the existing JAXB releases, for some specific types be handled by custom context providers. For ex, JAXB providers would check if ContextResolver<JAXBContext> was registered and then, say, ContextResolver.getContext(Foo.class) will be called.
I think that in CXF if it were say Collection<Foo> then a registered ContextResolver<JAXBContext>, if any, would not be asked for a JAXBContext for Collection<Foo> but for Foo only
cheers, Sergey
----- Original Message -----
From: Benson Margulies
To: Sergey Beryozkin ; CXF Dev
Sent: Tuesday, September 01, 2009 12:26 AM
Subject: Seeming JAX-RS mistake
This can't work right for generic types (like collections), since it doesn't use java.lang.reflect.Type.
public interface ContextResolver<T> {
/**
* Get a context of type <code>T</code> that is applicable to the supplied
* type.
* @param type the class of object for which a context is desired
* @return a context for the supplied type or <code>null</code> if a
* context for the supplied type is not available from this provider.
*/
T getContext(Class<?> type);
}