Hi Dan, This looks very interesting, but I'm curious why this code: ISlingProxyService slingProxyService;****
{…}**** Page page = slingProxyService.getProxy(resource, Page.class); Is not just Page page = resource.adaptTo(Page.class); Regards, Justin On Fri, Mar 29, 2013 at 3:14 PM, Dan Klco <dan.k...@sixdimensions.com>wrote: > Hello Everyone,**** > > **** > > A colleague (Michael Kelleher) and I have built an extension we would be > interested in incorporating into Sling, as a contributed module. **** > > **** > > A short synopsis of this is, it functions as a far simpler, read-only ORM > for Sling. It allows a developer to define an Interface, and with the use > of Annotations, and a Service, create an instance backed by resource(s) > within JCR. The mapping of method names to JCR properties is configured > with annotations and interpreted by the Java Proxy InvocationHandler to map > back to Sling Resources and properties.**** > > **** > > Here’s an example usage of the Sling Dynamic Proxy:**** > > **** > > public interface Page extends ISlingProxy {**** > > **** > > /****** > > * Gets the property jcr:created**** > > */**** > > @SlingProperty(name=”jcr:created”)**** > > public Date getCreationDate();**** > > **** > > /****** > > * Gets the property jcr:description at the sub path > jcr:content, the path is not required and can be absolute**** > > */**** > > @SlingProperty(name=”jcr:description”, path=”jcr:content”) > **** > > public String getDescription();**** > > **** > > /****** > > * Gets the property jcr:title at the sub path jcr:content, > the path is not required and can be absolute**** > > */**** > > @SlingProperty(name=”jcr:title”, path=”jcr:content”)**** > > public String getTitle();**** > > **** > > /****** > > * Gets the content resource, this could also return a > class which can be adapted from a resource or another proxy instance.**** > > */**** > > @SlingReference(path=”jcr:content”)**** > > public Resource getContentResource();**** > > **** > > /****** > > * Gets the children of the current resource, the return > type should match the return type in the generic of the return Iterator.** > ** > > */**** > > @SlingChildren(returnType=Resource.class, path=””)**** > > public Iterator<Resource> getChildren();**** > > }**** > > **** > > You could then retrieve an instance of the proxy as such:**** > > **** > > Resource resource;**** > > ISlingProxyService slingProxyService;**** > > {…}**** > > Page page = slingProxyService.getProxy(resource, Page.class);**** > > **** > > You can check out the code, including some basic tests on GitHub:**** > > https://github.com/sixdimensions/sling-proxy**** > > **** > > We both hope this project will be of interest to the Sling developers and > the Sling community.**** > > **** > > Thanks,**** > > ** ** > > Dan Klco**** > > Senior Staff Engineer, Adobe WEM / Day CQ5**** > > San Ramon, CA / Dayton, OH**** > > ** ** > > [image: Description: Description: Description: > cid:image003.gif@01CCF856.90108760] <http://www.sixdimensions.com/>**** > > Cell (937) 231-3050**** > > Office (937) 343-1326**** > > Fax (877) 510-5082**** > > LinkedIn <http://www.linkedin.com/in/klcodanr> | > @KlcoDanR<https://twitter.com/klcodanr> > **** > > ** ** > > *People. Deliver. Progress.* > > ** ** >