On 23.10.2014, at 15:14, Dominik Süß <dominik.su...@gmail.com> wrote:
> 
> adding some contexobject is IMHO not hidding anything.

It is - if you never see that behind the scenes a request object is passed 
along (and what not else), but in other cases outside the request scope it is 
not, this can be confusing. It is important to be aware of the request scope - 
and many folks are easily fooled by that (I know, not you and the others 
discussing this here).

> There are cases
> where you would want to have the context for creation of a model (or any
> other adaptable) - so at construction time which disqualifieds some method
> to be called afterwards.
> What't the issue with someresource.adaptTo(MyClass.class, request)  (or as
> bertrand mentioned any other payload) which could be used by the
> AdapterFactory?

Maybe, but I'd be reluctant to extend the adaptTo API in this way. (It might be 
very hard to extend that API, since so many code implements Adaptable).

> In case of Scripting languages as sightly we cannot easily create wrapper
> objects that are used for adaption that could hold the real adaptable and
> the additional context object(s).

You model could have a "RequestScoped" or some better named interface with a 
setRequest() method, which the sightly executor would cast to and use.

Just plain Java OO & interfaces... BTW, this is what I think is great about 
OSGi services, that they are based on plain Java interfaces and don't have all 
the complexities of DI frameworks such as Sling that try to do everything with 
magic behind the scenes.

Cheers,
Alex

Reply via email to