You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Radu Cotescu (Jira)" <ji...@apache.org> on 2019/11/14 15:08:00 UTC

[jira] [Resolved] (SLING-8737) Add support for lazily-evaluated bindings

     [ https://issues.apache.org/jira/browse/SLING-8737?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Radu Cotescu resolved SLING-8737.
---------------------------------
    Resolution: Fixed

Fixed in [commit 0324519|https://github.com/apache/sling-org-apache-sling-api/commit/0324519] and [commit 13a7367|https://github.com/apache/sling-org-apache-sling-scripting-core/commit/13a7367].

> Add support for lazily-evaluated bindings
> -----------------------------------------
>
>                 Key: SLING-8737
>                 URL: https://issues.apache.org/jira/browse/SLING-8737
>             Project: Sling
>          Issue Type: New Feature
>          Components: Scripting
>            Reporter: Radu Cotescu
>            Assignee: Radu Cotescu
>            Priority: Major
>             Fix For: Scripting Core 2.1.0, API 2.21.0
>
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> The {{org.apache.sling.scripting.core}} module provides support for passing a {{javax.script.Bindings}} to script engines, through the {{org.apache.sling.scripting.core.impl.DefaultSlingScript}} implementation of the {{org.apache.sling.api.scripting.SlingScript}} interface . {{org.apache.sling.scripting.core.impl.DefaultSlingScript}} relies directly on {{javax.script.SimpleBindings}}, which means that the values with which the map is populated have to be computed before insertion. In some cases these computations are not trivial, however there's no guarantee that the values will actually be used.
> In order to optimise the {{Bindings}} usage, given that Java 8 and above provide the [{{Supplier}}|https://docs.oracle.com/javase/8/docs/api/java/util/function/Supplier.html] functional interface, both the {{org.apache.sling.api}} and {{org.apache.sling.scripting.core}} modules should bring support for pusing {{Suppliers}} into the {{Bindings}} maps, suppliers which would be invoked on-demand.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)