icfnext / aem-library

The AEM Library provides a sturdy foundation for bootstrapping and simplifying for Adobe Experience Manager projects.
http://icfnext.github.io/aem-library
Other
22 stars 18 forks source link

@InheritInject a child node as a SlingModel #9

Closed modeckimellett closed 6 years ago

modeckimellett commented 6 years ago

I would like to be able to @InheritInject a Sling Model for a named sub-node of my current Resource backed Sling Model. @Inject already works for injecting Sling Models for child resources in this way but it does not provide an option to inherit.

The implementation would be something like

getNodeInherited(propertyName).get().resource.adaptTo(Type)

where propertyName is the sub-node path defined by the injected property's name and Type is the type of that property.

This would be especially relevant when used in conjunction with the @DialogFieldSet annotation in https://github.com/OlsonDigital/cq-component-maven-plugin as below:

    @DialogField(fieldLabel= "Sample Field", ranking = 1D)
    @DialogFieldSet(namePrefix = "./sampleField/")
    @InheritInject
    ReusableItem sampleField

Where ReusableItem extends AbstractComponent and has some dialog fields configured on it.

Note that this conflicts with #8

michaelhodgdon commented 6 years ago

added to develop