Document possibility of caching in Adaptable
--------------------------------------------

                 Key: SLING-1967
                 URL: https://issues.apache.org/jira/browse/SLING-1967
             Project: Sling
          Issue Type: Improvement
          Components: API
    Affects Versions: API 2.2.0
            Reporter: Alexander Klimetschek


SLING-1673 added caching in SlingAdaptable. This means that Adaptable.adapTo() 
users must be aware that there won't be a new instance of the requested object 
upon repeated calls. This should be documented in adaptTo(), i.e. that one 
cannot expect new instances - or rely on any behavior, be it always the same 
instance or always a new one.

This affects mostly adapters provided by AdapterFactories, as these will be 
behind the default caching implementation in SlingAdaptable. If adaptTo() is 
directly implemented in an object, it can chose itself whether it does caching 
or not. So I think the docs for AdapterFactory should also be changed to note 
that - something like "make sure you return re-usable objects here, as these 
might get cached and the adapter factory won't be called for each adaptTo call 
of the same object".

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to