Uploaded image for project: 'Sling'
  1. Sling
  2. SLING-5992

Provide a way to map Sling Model classes to resource types

    XMLWordPrintableJSON

    Details

      Description

      For ease of script development, I would like to introduce a mechanism for mapping Sling Model classes to resource types for Resource and SlingHttpServletRequest objects.

      From an API perspective, this introduces two new methods on ModelFactory:

      public Object getModelFromResource(@Nonnull Resource resource);
      public Object getModelFromRequest(@Nonnull SlingHttpServletRequest request);
      

      And a new attribute on the @Model annotations

      public String resourceType() default "";
      

        Attachments

        1. SLING-5992.patch
          67 kB
          Justin Edelson

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              justinedelson Justin Edelson
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: