Marc Hadley wrote:
> On Jun 26, 2008, at 3:12 AM, Paul Sandoz wrote:
>>>
>>> The getContextResolver method offers us an opportunity to simplify
>>> things. Rather than injecting a ContextResolver directly with
>>> @Context and requiring that the injected instance actually be a proxy
>>> that searches for a context resolver of the specified type for a
>>> particular class (did I mention it was complicated), instead we can
>>> define the method like this:
>>>
>>> <T> T getContext(Class<T> contextType, Class<?> objectType)
>>>
>>> So to get a JAXBContext for some JAXB bean Foo you'd write:
>>>
>>> @Context Providers p;
>>> JAXBContext jbc = p.getContext(JAXBContext.class, Foo.class);
>>>
>>> Much nicer !
>>>
>>
>> From what perspective? from the client i don't think it is easier.
>> From that perspective i prefer the current interface.
>>
>
> I think its awkward the way you currently have to inject a proxy
> implementing ContextResolver<T> that then calls each provider in turn.
> Users might reasonably assume that if they implement
> ContextResolver<JAXBContext> in a class and then inject a field of the
> same type they will get the actual instance of the resolver class.
>
> To be clear I'm not suggesting removing the ContextResolver interface,
> just changing how you get access to the contexts that implementations
> provide (via the Providers interface).
>
BTW, I thought we were going to pass in a MediaType for ContextResolver
resolving?
Bill
--
Bill Burke
JBoss, a division of Red Hat
http://bill.burkecentral.com