You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by Felix Meschberger <fm...@adobe.com> on 2015/01/12 10:44:23 UTC

[SLING-4275] API: Record Interface

Hi all

Carsten started to review the Sightly Engine API in SLING-4275 [1]. Since this issue covers 4 topics, I think it would be best to quickly discuss these topic in separate threads.

#3 Record Interface

The Record interface is used primarily by the Java POJO UseProvider to inject properties back into the Sightly template bindings: If the object loaded by the provider happens to implement the Record interface, the respective properties are injected into the current bindings.

The Question is whether this interface is specific to the Java POJO UseProvider or not ?

If it is specific, it should probably be moved into a pojo sub package.

WDYT ?

Regards
Felix

[1] https://issues.apache.org/jira/browse/SLING-4275

Re: [SLING-4275] API: Record Interface

Posted by Carsten Ziegeler <cz...@apache.org>.
Am 13.01.15 um 15:36 schrieb Radu Cotescu:
> Hi,
> 
> We could do this, but in this case I'd suggest to go for something like:
> 
> T getValueForProperty(String propertyName) instead of T get(String name)
> 
> Set<String> getPropertyNames() instead of Set<String> properties()
> 
> WDYT?

Yes get() doesn't look nice either :) I would go for getValue() but
getValueForProperty is fine as well

Carsten

> 
> Radu
> 
> On Tue, Jan 13, 2015 at 12:49 PM, Carsten Ziegeler <cz...@apache.org>
> wrote:
> 
>> Can we at least rename the properties() method to getPropertyNames()
>>
>> Carsten
>>
>> Am 12.01.15 um 18:55 schrieb Radu Cotescu:
>>> Hi,
>>>
>>> The Record interface is more complex. Besides being used in the JS Use
>>> Provider code for injecting global objects to the current bindings, the
>>> interface is also used to allow Sightly templates (defined through
>>> data-sly-template) to contain other templates (imbricated
>> data-sly-template
>>> block elements).
>>>
>>> Since Sightly templates are loaded through the Use API (e.g. <div
>>> data-sly-use.tmplLibrary="/apps/myproj/components/templates.html">...),
>>> templates become objects in a Sightly script. Templates embedded in
>> another
>>> template become properties of the main template object. The Record
>>> interface provides this flexibility.
>>>
>>> HTH,
>>> Radu
>>>
>>> On Mon, Jan 12, 2015 at 11:44 AM, Felix Meschberger <fm...@adobe.com>
>>> wrote:
>>>
>>>> Hi all
>>>>
>>>> Carsten started to review the Sightly Engine API in SLING-4275 [1].
>> Since
>>>> this issue covers 4 topics, I think it would be best to quickly discuss
>>>> these topic in separate threads.
>>>>
>>>> #3 Record Interface
>>>>
>>>> The Record interface is used primarily by the Java POJO UseProvider to
>>>> inject properties back into the Sightly template bindings: If the object
>>>> loaded by the provider happens to implement the Record interface, the
>>>> respective properties are injected into the current bindings.
>>>>
>>>> The Question is whether this interface is specific to the Java POJO
>>>> UseProvider or not ?
>>>>
>>>> If it is specific, it should probably be moved into a pojo sub package.
>>>>
>>>> WDYT ?
>>>>
>>>> Regards
>>>> Felix
>>>>
>>>> [1] https://issues.apache.org/jira/browse/SLING-4275
>>>
>>
>>
>> --
>> Carsten Ziegeler
>> Adobe Research Switzerland
>> cziegeler@apache.org
>>
> 


-- 
Carsten Ziegeler
Adobe Research Switzerland
cziegeler@apache.org

Re: [SLING-4275] API: Record Interface

Posted by Radu Cotescu <ra...@apache.org>.
Hi,

We could do this, but in this case I'd suggest to go for something like:

T getValueForProperty(String propertyName) instead of T get(String name)

Set<String> getPropertyNames() instead of Set<String> properties()

WDYT?

Radu

On Tue, Jan 13, 2015 at 12:49 PM, Carsten Ziegeler <cz...@apache.org>
wrote:

> Can we at least rename the properties() method to getPropertyNames()
>
> Carsten
>
> Am 12.01.15 um 18:55 schrieb Radu Cotescu:
> > Hi,
> >
> > The Record interface is more complex. Besides being used in the JS Use
> > Provider code for injecting global objects to the current bindings, the
> > interface is also used to allow Sightly templates (defined through
> > data-sly-template) to contain other templates (imbricated
> data-sly-template
> > block elements).
> >
> > Since Sightly templates are loaded through the Use API (e.g. <div
> > data-sly-use.tmplLibrary="/apps/myproj/components/templates.html">...),
> > templates become objects in a Sightly script. Templates embedded in
> another
> > template become properties of the main template object. The Record
> > interface provides this flexibility.
> >
> > HTH,
> > Radu
> >
> > On Mon, Jan 12, 2015 at 11:44 AM, Felix Meschberger <fm...@adobe.com>
> > wrote:
> >
> >> Hi all
> >>
> >> Carsten started to review the Sightly Engine API in SLING-4275 [1].
> Since
> >> this issue covers 4 topics, I think it would be best to quickly discuss
> >> these topic in separate threads.
> >>
> >> #3 Record Interface
> >>
> >> The Record interface is used primarily by the Java POJO UseProvider to
> >> inject properties back into the Sightly template bindings: If the object
> >> loaded by the provider happens to implement the Record interface, the
> >> respective properties are injected into the current bindings.
> >>
> >> The Question is whether this interface is specific to the Java POJO
> >> UseProvider or not ?
> >>
> >> If it is specific, it should probably be moved into a pojo sub package.
> >>
> >> WDYT ?
> >>
> >> Regards
> >> Felix
> >>
> >> [1] https://issues.apache.org/jira/browse/SLING-4275
> >
>
>
> --
> Carsten Ziegeler
> Adobe Research Switzerland
> cziegeler@apache.org
>

Re: [SLING-4275] API: Record Interface

Posted by Carsten Ziegeler <cz...@apache.org>.
Can we at least rename the properties() method to getPropertyNames()

Carsten

Am 12.01.15 um 18:55 schrieb Radu Cotescu:
> Hi,
> 
> The Record interface is more complex. Besides being used in the JS Use
> Provider code for injecting global objects to the current bindings, the
> interface is also used to allow Sightly templates (defined through
> data-sly-template) to contain other templates (imbricated data-sly-template
> block elements).
> 
> Since Sightly templates are loaded through the Use API (e.g. <div
> data-sly-use.tmplLibrary="/apps/myproj/components/templates.html">...),
> templates become objects in a Sightly script. Templates embedded in another
> template become properties of the main template object. The Record
> interface provides this flexibility.
> 
> HTH,
> Radu
> 
> On Mon, Jan 12, 2015 at 11:44 AM, Felix Meschberger <fm...@adobe.com>
> wrote:
> 
>> Hi all
>>
>> Carsten started to review the Sightly Engine API in SLING-4275 [1]. Since
>> this issue covers 4 topics, I think it would be best to quickly discuss
>> these topic in separate threads.
>>
>> #3 Record Interface
>>
>> The Record interface is used primarily by the Java POJO UseProvider to
>> inject properties back into the Sightly template bindings: If the object
>> loaded by the provider happens to implement the Record interface, the
>> respective properties are injected into the current bindings.
>>
>> The Question is whether this interface is specific to the Java POJO
>> UseProvider or not ?
>>
>> If it is specific, it should probably be moved into a pojo sub package.
>>
>> WDYT ?
>>
>> Regards
>> Felix
>>
>> [1] https://issues.apache.org/jira/browse/SLING-4275
> 


-- 
Carsten Ziegeler
Adobe Research Switzerland
cziegeler@apache.org

Re: [SLING-4275] API: Record Interface

Posted by Radu Cotescu <ra...@apache.org>.
Hi,

The Record interface is more complex. Besides being used in the JS Use
Provider code for injecting global objects to the current bindings, the
interface is also used to allow Sightly templates (defined through
data-sly-template) to contain other templates (imbricated data-sly-template
block elements).

Since Sightly templates are loaded through the Use API (e.g. <div
data-sly-use.tmplLibrary="/apps/myproj/components/templates.html">...),
templates become objects in a Sightly script. Templates embedded in another
template become properties of the main template object. The Record
interface provides this flexibility.

HTH,
Radu

On Mon, Jan 12, 2015 at 11:44 AM, Felix Meschberger <fm...@adobe.com>
wrote:

> Hi all
>
> Carsten started to review the Sightly Engine API in SLING-4275 [1]. Since
> this issue covers 4 topics, I think it would be best to quickly discuss
> these topic in separate threads.
>
> #3 Record Interface
>
> The Record interface is used primarily by the Java POJO UseProvider to
> inject properties back into the Sightly template bindings: If the object
> loaded by the provider happens to implement the Record interface, the
> respective properties are injected into the current bindings.
>
> The Question is whether this interface is specific to the Java POJO
> UseProvider or not ?
>
> If it is specific, it should probably be moved into a pojo sub package.
>
> WDYT ?
>
> Regards
> Felix
>
> [1] https://issues.apache.org/jira/browse/SLING-4275