Class DefaultRewriteContentHandler

  • All Implemented Interfaces:
    RewriteContentHandler

    @Model(adaptables={org.apache.sling.api.SlingHttpServletRequest.class,org.apache.sling.api.resource.Resource.class})
    public final class DefaultRewriteContentHandler
    extends java.lang.Object
    implements RewriteContentHandler
    Default implementation of RewriteContentHandler.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      @Nullable java.util.List<org.jdom2.Content> rewriteElement​(@NotNull org.jdom2.Element element)
      Checks if the given element has to be rewritten.
      @Nullable java.util.List<org.jdom2.Content> rewriteText​(@NotNull org.jdom2.Text text)
      Checks if the given text node has to be rewritten.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • DefaultRewriteContentHandler

        public DefaultRewriteContentHandler()
    • Method Detail

      • rewriteElement

        @Nullable
        public @Nullable java.util.List<org.jdom2.Content> rewriteElement​(@NotNull
                                                                          @NotNull org.jdom2.Element element)
        Checks if the given element has to be rewritten. Is called for every child single element of the parent given to rewriteContent method.
        Specified by:
        rewriteElement in interface RewriteContentHandler
        Parameters:
        element - Element to check
        Returns:
        null if nothing is to do with this element. Return empty list to remove this element. Return list with other content to replace element with new content.
      • rewriteText

        @Nullable
        public @Nullable java.util.List<org.jdom2.Content> rewriteText​(@NotNull
                                                                       @NotNull org.jdom2.Text text)
        Description copied from interface: RewriteContentHandler
        Checks if the given text node has to be rewritten. Is called for every text node found as parent of given to rewriteContent method.
        Specified by:
        rewriteText in interface RewriteContentHandler
        Parameters:
        text - Text node
        Returns:
        null if nothing is to do with this element. Return empty list to remove the element. Return list with other content to replace element with new content.