[SLING-4275] API: Record Interface

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

[SLING-4275] API: Record Interface

Felix Meschberger-3
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
Reply | Threaded
Open this post in threaded view
|

Re: [SLING-4275] API: Record Interface

Radu Cotescu-3
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 <[hidden email]>
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
Reply | Threaded
Open this post in threaded view
|

Re: [SLING-4275] API: Record Interface

Carsten Ziegeler
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 <[hidden email]>
> 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
[hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: [SLING-4275] API: Record Interface

Radu Cotescu-3
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 <[hidden email]>
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 <[hidden email]>
> > 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
> [hidden email]
>
Reply | Threaded
Open this post in threaded view
|

Re: [SLING-4275] API: Record Interface

Carsten Ziegeler
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 <[hidden email]>
> 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 <[hidden email]>
>>> 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
>> [hidden email]
>>
>


--
Carsten Ziegeler
Adobe Research Switzerland
[hidden email]