You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Stefan Seifert (JIRA)" <ji...@apache.org> on 2016/09/05 20:12:20 UTC

[jira] [Commented] (SLING-6036) ResourceBuilder: Reusing ResourceBuilder instances

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

Stefan Seifert commented on SLING-6036:
---------------------------------------

Revision: 1759351

[~bdelacretaz] please have a look at [these changes|https://github.com/apache/sling/commit/8d317a0ab6e9a4365cee9ace48585245e55ca609]. all existing unit tests still pass, i've added a new one.
we can revert if if you think it does not fit into the resourcebuilder concept.

> ResourceBuilder: Reusing ResourceBuilder instances
> --------------------------------------------------
>
>                 Key: SLING-6036
>                 URL: https://issues.apache.org/jira/browse/SLING-6036
>             Project: Sling
>          Issue Type: Improvement
>          Components: Extensions
>            Reporter: Stefan Seifert
>            Assignee: Stefan Seifert
>            Priority: Minor
>             Fix For: Resource Builder 1.0.0
>
>
> follow-up from discussion in [SLING-5356|https://issues.apache.org/jira/browse/SLING-5356?focusedCommentId=15458657#comment-15458657]
> B) reusing resourcebuilder instances
> example 2:
> {noformat}
> resourceBuilder = getService(ResourceBuilder.class).forResolver(resourceResolver);
> resourceBuilder.resource("content/page1");
> resourceBuilder.resource("content/page2");
> {noformat}
> this produces not the expected result - it produces
> /content/page1
> /content/page1/content/page2
> instead of 
> /content/page1
> /content/page2
> it would be useful if the resourcebuilder returned by a resource method has a new parent set, but not the builder instance initially applyed the resource method on.
> currently the only way to get the expected result is something like:
> example 3:
> {noformat}
> resourceBuilder = getService(ResourceBuilder.class).forResolver(resourceResolver);
> resourceBuilder.resource("content/page1")
> .atParent()
> resource("content/page2");
> {noformat}
> but if creating bigger content structures it makes sense to not use one gigantic fluent line, but split if up in smaller parts.



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