[ 
https://issues.apache.org/jira/browse/JCR-3870?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14483223#comment-14483223
 ] 

Marcel Reutegger commented on JCR-3870:
---------------------------------------

I would rather not make this method public. The specification requires an 
implementation to first check if a node exists at the given path and then check 
if there is a property. As written already in JavaDoc of {{Session.getItem()}}, 
you should not use this method if you already know the item is a node or a 
property and I assume Sling knows what kind of item it is looking for:

bq. This method should only be used if the application does not know whether 
the item at the indicated path is property or node. In cases where the 
application has this information, either getNode(java.lang.String) or 
getProperty(java.lang.String) should be used, as appropriate. In many 
repository implementations the node and property-specific methods are likely to 
be more efficient than getItem.

If really needed I would prefer to export getNodeOrNull() and 
getPropertyOrNull() variants.

> Export SessionImpl#getItemOrNull in JackrabbitSession
> -----------------------------------------------------
>
>                 Key: JCR-3870
>                 URL: https://issues.apache.org/jira/browse/JCR-3870
>             Project: Jackrabbit Content Repository
>          Issue Type: Improvement
>          Components: jackrabbit-api
>    Affects Versions: 2.10
>            Reporter: Joel Richard
>            Priority: Critical
>              Labels: performance
>
> getItemOrNull should be exported in JackrabbitSession. This would allow to 
> combine itemExists and getItem in Sling which would reduce the rendering time 
> by 8%.
> See the following mail thread for more information: 
> http://mail-archives.apache.org/mod_mbox/jackrabbit-oak-dev/201504.mbox/browser



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to