Package org.apache.sling.rewriter

## Class DefaultTransformer

- java.lang.Object
- - org.apache.sling.rewriter.DefaultTransformer

All Implemented Interfaces:
  `Transformer`, `ContentHandler`

    public class DefaultTransformer
    extends Object
    implements Transformer

A generic base transformer which simply delegates all ContentHandler method invocations to the next ContentHandler.

### Field Summary

Fields
`protected ProcessingComponentConfiguration` `config`
`protected Locator` `documentLocator`
`protected ProcessingContext` `processingContext`

### Constructor Summary

Constructors
`DefaultTransformer()`

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `characters​(char[] ac, int i, int j)`
`void` `dispose()` Dispose the transformer.
`void` `endDocument()`
`void` `endElement​(String s, String s1, String s2)`
`void` `endPrefixMapping​(String s)`
`protected ContentHandler` `getContentHandler()`
`void` `ignorableWhitespace​(char[] ac, int i, int j)`
`void` `init​(ProcessingContext context, ProcessingComponentConfiguration config)` Initialize this component.
`void` `processingInstruction​(String s, String s1)`
`void` `setContentHandler​(ContentHandler handler)` Set the content handler the transformer should stream to.
`void` `setDocumentLocator​(Locator locator)`
`void` `skippedEntity​(String s)`
`void` `startDocument()`
`void` `startElement​(String s, String s1, String s2, Attributes attributes)`
`void` `startPrefixMapping​(String s, String s1)`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### config

    protected ProcessingComponentConfiguration config

#### documentLocator

    protected Locator documentLocator

#### processingContext

    protected ProcessingContext processingContext

### Constructor Detail

#### DefaultTransformer

    public DefaultTransformer()

### Method Detail

#### characters

    public void characters​(char[] ac,
                           int i,
                           int j)
                    throws SAXException

Specified by:
  `characters` in interface `ContentHandler`
Throws:
  `SAXException`

#### dispose

    public void dispose()

Description copied from interface: `Transformer`
Dispose the transformer. This method is always invoked by the rewriter in order to allow the transformer to release any resources etc. After this method has been called the instance is considered unusable.

Specified by:
  `dispose` in interface `Transformer`

#### endDocument

    public void endDocument()
                     throws SAXException

Specified by:
  `endDocument` in interface `ContentHandler`
Throws:
  `SAXException`

#### endElement

    public void endElement​(String s,
                           String s1,
                           String s2)
                    throws SAXException

Specified by:
  `endElement` in interface `ContentHandler`
Throws:
  `SAXException`

#### endPrefixMapping

    public void endPrefixMapping​(String s)
                          throws SAXException

Specified by:
  `endPrefixMapping` in interface `ContentHandler`
Throws:
  `SAXException`

#### ignorableWhitespace

    public void ignorableWhitespace​(char[] ac,
                                    int i,
                                    int j)
                             throws SAXException

Specified by:
  `ignorableWhitespace` in interface `ContentHandler`
Throws:
  `SAXException`

#### init

    public void init​(ProcessingContext context,
                     ProcessingComponentConfiguration config)
              throws IOException

Description copied from interface: `Transformer`
Initialize this component.

Specified by:
  `init` in interface `Transformer`
Parameters:
  `context` - The invocation context.
  `config` - The configuration for this component.
Throws:
  `IOException` - in case of any problems

#### processingInstruction

    public void processingInstruction​(String s,
                                      String s1)
                               throws SAXException

Specified by:
  `processingInstruction` in interface `ContentHandler`
Throws:
  `SAXException`

#### setContentHandler

    public final void setContentHandler​(ContentHandler handler)

Description copied from interface: `Transformer`
Set the content handler the transformer should stream to.

Specified by:
  `setContentHandler` in interface `Transformer`
Parameters:
  `handler` - Another transformer or a serializer.

#### setDocumentLocator

    public void setDocumentLocator​(Locator locator)

Specified by:
  `setDocumentLocator` in interface `ContentHandler`

#### skippedEntity

    public void skippedEntity​(String s)
                       throws SAXException

Specified by:
  `skippedEntity` in interface `ContentHandler`
Throws:
  `SAXException`

#### startDocument

    public void startDocument()
                       throws SAXException

Specified by:
  `startDocument` in interface `ContentHandler`
Throws:
  `SAXException`

#### startElement

    public void startElement​(String s,
                             String s1,
                             String s2,
                             Attributes attributes)
                      throws SAXException

Specified by:
  `startElement` in interface `ContentHandler`
Throws:
  `SAXException`

#### startPrefixMapping

    public void startPrefixMapping​(String s,
                                   String s1)
                            throws SAXException

Specified by:
  `startPrefixMapping` in interface `ContentHandler`
Throws:
  `SAXException`

#### getContentHandler

    protected ContentHandler getContentHandler()