Package org.eclipse.emf.compare.ide.internal.utils

# Class ForwardingXMLHandler

java.lang.Object
org.xml.sax.helpers.DefaultHandler
org.eclipse.emf.ecore.xmi.impl.XMLHandler
org.eclipse.emf.compare.ide.internal.utils.ForwardingXMLHandler

All Implemented Interfaces:
  `XMLDefaultHandler`, `ContentHandler`, `DTDHandler`, `EntityResolver`, `ErrorHandler`, `LexicalHandler`

public class ForwardingXMLHandler extends XMLHandler
This implementation of an `XMLHandler` will forward all calls to its delegate.

## Nested Class Summary

## Nested classes/interfaces inherited from class org.eclipse.emf.ecore.xmi.impl.XMLHandler

`XMLHandler.ManyReference, XMLHandler.MyEObjectStack, XMLHandler.MyStack<E>, XMLHandler.SingleReference`

## Field Summary

Fields
Modifier and Type
Field
Description
`protected final XMLHandler`
`delegate`
The delegate to which we'll forward all calls.

### Fields inherited from class org.eclipse.emf.ecore.xmi.impl.XMLHandler

`anySimpleType, anyType, ARRAY_SIZE, attribs, capacity, contextFeature, DEBUG_DEMANDED_PACKAGES, deferIDREFResolution, deferredExtent, disableNotify, DOCUMENT_ROOT_TYPE, documentRoot, ecoreBuilder, elements, eObjectToExtensionMap, ERROR_TYPE, extendedMetaData, extent, externalURIToLocations, featuresToKinds, forwardManyReferences, forwardSingleReferences, helper, hrefAttribute, idAttribute, identifiers, isIDREF, isNamespaceAware, isRoot, isSimpleFeature, laxWildcardProcessing, locator, missingPackageHandler, mixedTargets, needsPushContext, NIL_ATTRIB, NO_NAMESPACE_SCHEMA_LOCATION_ATTRIB, notFeatures, OBJECT_TYPE, objects, oldStyleProxyURIs, packageRegistry, positions, prefixesToFactories, processAnyXML, processSchemaLocations, recordAnyTypeNSDecls, recordUnknownFeature, REFERENCE_THRESHOLD, resolve, resolveEntities, resourceEntityHandler, resourceSet, resourceURI, sameDocumentProxies, SCHEMA_LOCATION_ATTRIB, suppressDocumentRoot, text, TYPE_ATTRIB, types, UNKNOWN_FEATURE_TYPE, uriHandler, urisToLocations, useConfigurationCache, usedNullNamespacePackage, useNewMethods, usePackageNsURIAsLocation, xmlMap, xmlResource, xmlSchemaTypePackage`

## Constructor Summary

Constructors
Constructor
Description
`ForwardingXMLHandler(XMLHandler delegate, XMLResource xmlResource, XMLHelper helper, Map<?,?> options)`
Creates this forwarding handler given its delegate.

## Method Summary

Modifier and Type
Method
Description
`void`
`characters(char[] ch, int start, int length)`
`void`
`comment(char[] ch, int start, int length)`
`protected XMLHandler`
`delegate()`
Returns the delegate instance that methods are forwarded to.
`void`
`endCDATA()`
`void`
`endDocument()`
`void`
`endDTD()`
`void`
`endElement(String uri, String localName, String name)`
`void`
`endEntity(String name)`
`void`
`endPrefixMapping(String prefix)`
`boolean`
`equals(Object obj)`
`void`
`error(XMIException e)`
`void`
`error(SAXParseException e)`
`void`
`fatalError(XMIException e)`
`void`
`fatalError(SAXParseException e)`
`protected String`
`getXSIType()`
`protected void`
`handleObjectAttribs(EObject obj)`
`int`
`hashCode()`
`void`
`ignorableWhitespace(char[] ch, int start, int length)`
`void`
`notationDecl(String name, String publicId, String systemId)`
`void`
`prepare(XMLResource resource, XMLHelper xmlHelper, Map<?,?> options)`
`void`
`processingInstruction(String target, String data)`
`protected static Object`
`reflectiveCall(String key, Object target, String methodName, Object... params)`
Calls a given method through reflection after setting it `accessible`.
`void`
`reset()`
`InputSource`
`resolveEntity(String publicId, String systemId)`
`void`
`setDocumentLocator(Locator locator)`
`protected static void`
`setField(String fieldName, Object target, Object value)`
Sets the given field through reflection after setting it `accessible`.
`void`
`skippedEntity(String name)`
`void`
`startCDATA()`
`void`
`startDocument()`
`void`
`startDTD(String name, String publicId, String systemId)`
`void`
`startElement(String uri, String localName, String name)`
`void`
`startElement(String uri, String localName, String qName, Attributes attributes)`
`void`
`startEntity(String name)`
`void`
`startPrefixMapping(String prefix, String uri)`
`String`
`toString()`
`void`
`unparsedEntityDecl(String name, String publicId, String systemId, String notationName)`
`void`
`warning(XMIException e)`
`void`
`warning(SAXParseException e)`

### Methods inherited from class org.eclipse.emf.ecore.xmi.impl.XMLHandler

`createDocumentRoot, createEcoreBuilder, createObject, createObject, createObjectByType, createObjectFromFactory, createObjectFromFeatureType, createObjectFromTypeName, createTopObject, getColumnNumber, getExtension, getFactoryForPrefix, getFeature, getFeature, getLineNumber, getLocation, getPackageForURI, getURIConverter, getXMLEncoding, growArrays, handleCDATA, handleComment, handleFeature, handleForwardReferences, handleForwardReferences, handleMissingPackage, handleMixedText, handleNamespaceAttribs, handleProcessingInstruction, handleProxy, handleSchemaLocation, handleTopLocations, handleUnknownFeature, handleXMLNSAttribute, handleXSINoNamespaceSchemaLocation, handleXSISchemaLocation, isError, isNull, isTextFeatureValue, processElement, processObject, processSchemaLocations, processTopObject, recordHeaderInformation, recordNamespacesSchemaLocations, recordUnknownFeature, reportUnknownFeature, setAttributes, setAttribValue, setExtendedMetaDataOption, setFeatureValue, setFeatureValue, setFeatureValues, setLocator, setValueFromId, toXMIException, validateCreateObjectFromFactory, validateCreateObjectFromFactory, validateCreateObjectFromFactory`

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

`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

### Methods inherited from interface org.xml.sax.ContentHandler

`declaration`

## Field Details

### delegate

protected final XMLHandler delegate
The delegate to which we'll forward all calls.

## Constructor Details

### ForwardingXMLHandler

public ForwardingXMLHandler(XMLHandler delegate, XMLResource xmlResource, XMLHelper helper, Map<?,?> options)
Creates this forwarding handler given its delegate. All other parameters are only used to call the mandatory super-constructor... but none should be of any use here.

Parameters:
  `delegate` - Our delegate XMLHandler.
  `xmlResource` - The resource we'll be loading. Mandatory for the super-constructor, but we'll forward all calls to `delegate` anyway.
  `helper` - The xml helper to use. Mandatory for the super-constructor, but we'll forward all calls to `delegate` anyway.
  `options` - The load options that were specified. Mandatory for the super-constructor, but we'll forward all calls to `delegate` anyway.

## Method Details

### delegate

protected XMLHandler delegate()
Returns the delegate instance that methods are forwarded to.

Returns:
  The delegate instance that methods are forwarded to.

### endDocument

public void endDocument()

Specified by:
  `endDocument` in interface `ContentHandler`
Overrides:
  `endDocument` in class `XMLHandler`
See Also:
  - `XMLHandler.endDocument()`

### characters

public void characters(char[] ch, int start, int length)

Specified by:
  `characters` in interface `ContentHandler`
Overrides:
  `characters` in class `XMLHandler`
See Also:
  - `XMLHandler.characters(char[], int, int)`

### comment

public void comment(char[] ch, int start, int length)

Specified by:
  `comment` in interface `LexicalHandler`
Overrides:
  `comment` in class `XMLHandler`
See Also:
  - `XMLHandler.comment(char[], int, int)`

### endCDATA

public void endCDATA()

Specified by:
  `endCDATA` in interface `LexicalHandler`
Overrides:
  `endCDATA` in class `XMLHandler`
See Also:
  - `XMLHandler.endCDATA()`

### endDTD

public void endDTD()

Specified by:
  `endDTD` in interface `LexicalHandler`
Overrides:
  `endDTD` in class `XMLHandler`
See Also:
  - `XMLHandler.endDTD()`

### endElement

public void endElement(String uri, String localName, String name)

Specified by:
  `endElement` in interface `ContentHandler`
Overrides:
  `endElement` in class `XMLHandler`
See Also:
  - `XMLHandler.endElement(java.lang.String, java.lang.String, java.lang.String)`

### endEntity

public void endEntity(String name)

Specified by:
  `endEntity` in interface `LexicalHandler`
Overrides:
  `endEntity` in class `XMLHandler`
See Also:
  - `XMLHandler.endEntity(java.lang.String)`

### endPrefixMapping

public void endPrefixMapping(String prefix)

Specified by:
  `endPrefixMapping` in interface `ContentHandler`
Overrides:
  `endPrefixMapping` in class `XMLHandler`
See Also:
  - `XMLHandler.endPrefixMapping(java.lang.String)`

### equals

public boolean equals(Object obj)

Overrides:
  `equals` in class `Object`
See Also:
  - `Object.equals(java.lang.Object)`

### error

public void error(SAXParseException e) throws SAXException

Specified by:
  `error` in interface `ErrorHandler`
Overrides:
  `error` in class `XMLHandler`
Throws:
  `SAXException`
See Also:
  - `XMLHandler.error(org.xml.sax.SAXParseException)`

### error

public void error(XMIException e)

Overrides:
  `error` in class `XMLHandler`
See Also:
  - `XMLHandler.error(org.eclipse.emf.ecore.xmi.XMIException)`

### fatalError

public void fatalError(SAXParseException e) throws SAXException

Specified by:
  `fatalError` in interface `ErrorHandler`
Overrides:
  `fatalError` in class `XMLHandler`
Throws:
  `SAXException`
See Also:
  - `XMLHandler.fatalError(org.xml.sax.SAXParseException)`

### fatalError

public void fatalError(XMIException e)

Overrides:
  `fatalError` in class `XMLHandler`
See Also:
  - `XMLHandler.fatalError(org.eclipse.emf.ecore.xmi.XMIException)`

### hashCode

public int hashCode()

Overrides:
  `hashCode` in class `Object`
See Also:
  - `Object.hashCode()`

### ignorableWhitespace

public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException

Specified by:
  `ignorableWhitespace` in interface `ContentHandler`
Overrides:
  `ignorableWhitespace` in class `XMLHandler`
Throws:
  `SAXException`
See Also:
  - `XMLHandler.ignorableWhitespace(char[], int, int)`

### notationDecl

public void notationDecl(String name, String publicId, String systemId) throws SAXException

Specified by:
  `notationDecl` in interface `DTDHandler`
Overrides:
  `notationDecl` in class `XMLHandler`
Throws:
  `SAXException`
See Also:
  - `XMLHandler.notationDecl(java.lang.String, java.lang.String, java.lang.String)`

### prepare

public void prepare(XMLResource resource, XMLHelper xmlHelper, Map<?,?> options)

Specified by:
  `prepare` in interface `XMLDefaultHandler`
Overrides:
  `prepare` in class `XMLHandler`
See Also:
  - `XMLHandler.prepare(org.eclipse.emf.ecore.xmi.XMLResource, org.eclipse.emf.ecore.xmi.XMLHelper, java.util.Map)`

### processingInstruction

public void processingInstruction(String target, String data)

Specified by:
  `processingInstruction` in interface `ContentHandler`
Overrides:
  `processingInstruction` in class `XMLHandler`
See Also:
  - `XMLHandler.processingInstruction(java.lang.String, java.lang.String)`

### reset

public void reset()

Specified by:
  `reset` in interface `XMLDefaultHandler`
Overrides:
  `reset` in class `XMLHandler`
See Also:
  - `XMLHandler.reset()`

### resolveEntity

public InputSource resolveEntity(String publicId, String systemId) throws SAXException

Specified by:
  `resolveEntity` in interface `EntityResolver`
Overrides:
  `resolveEntity` in class `XMLHandler`
Throws:
  `SAXException`
See Also:
  - `XMLHandler.resolveEntity(java.lang.String, java.lang.String)`

### setDocumentLocator

public void setDocumentLocator(Locator locator)

Specified by:
  `setDocumentLocator` in interface `ContentHandler`
Overrides:
  `setDocumentLocator` in class `XMLHandler`
See Also:
  - `XMLHandler.setDocumentLocator(org.xml.sax.Locator)`

### skippedEntity

public void skippedEntity(String name) throws SAXException

Specified by:
  `skippedEntity` in interface `ContentHandler`
Overrides:
  `skippedEntity` in class `XMLHandler`
Throws:
  `SAXException`
See Also:
  - `XMLHandler.skippedEntity(java.lang.String)`

### startCDATA

public void startCDATA()

Specified by:
  `startCDATA` in interface `LexicalHandler`
Overrides:
  `startCDATA` in class `XMLHandler`
See Also:
  - `XMLHandler.startCDATA()`

### startDocument

public void startDocument()

Specified by:
  `startDocument` in interface `ContentHandler`
Overrides:
  `startDocument` in class `XMLHandler`
See Also:
  - `XMLHandler.startDocument()`

### startDTD

public void startDTD(String name, String publicId, String systemId)

Specified by:
  `startDTD` in interface `LexicalHandler`
Overrides:
  `startDTD` in class `XMLHandler`
See Also:
  - `XMLHandler.startDTD(java.lang.String, java.lang.String, java.lang.String)`

### startElement

public void startElement(String uri, String localName, String name)

Overrides:
  `startElement` in class `XMLHandler`
See Also:
  - `XMLHandler.startElement(java.lang.String, java.lang.String, java.lang.String)`

### startElement

public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException

Specified by:
  `startElement` in interface `ContentHandler`
Overrides:
  `startElement` in class `XMLHandler`
Throws:
  `SAXException`
See Also:
  - `XMLHandler.startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)`

### startEntity

public void startEntity(String name)

Specified by:
  `startEntity` in interface `LexicalHandler`
Overrides:
  `startEntity` in class `XMLHandler`
See Also:
  - `XMLHandler.startEntity(java.lang.String)`

### startPrefixMapping

public void startPrefixMapping(String prefix, String uri)

Specified by:
  `startPrefixMapping` in interface `ContentHandler`
Overrides:
  `startPrefixMapping` in class `XMLHandler`
See Also:
  - `XMLHandler.startPrefixMapping(java.lang.String, java.lang.String)`

### toString

public String toString()

Overrides:
  `toString` in class `Object`
See Also:
  - `Object.toString()`

### unparsedEntityDecl

public void unparsedEntityDecl(String name, String publicId, String systemId, String notationName) throws SAXException

Specified by:
  `unparsedEntityDecl` in interface `DTDHandler`
Overrides:
  `unparsedEntityDecl` in class `XMLHandler`
Throws:
  `SAXException`
See Also:
  - `XMLHandler.unparsedEntityDecl(java.lang.String, java.lang.String, java.lang.String, java.lang.String)`

### warning

public void warning(SAXParseException e) throws SAXException

Specified by:
  `warning` in interface `ErrorHandler`
Overrides:
  `warning` in class `XMLHandler`
Throws:
  `SAXException`
See Also:
  - `XMLHandler.warning(org.xml.sax.SAXParseException)`

### warning

public void warning(XMIException e)

Overrides:
  `warning` in class `XMLHandler`
See Also:
  - `XMLHandler.warning(org.eclipse.emf.ecore.xmi.XMIException)`

### getXSIType

protected String getXSIType()

Specified by:
  `getXSIType` in class `XMLHandler`
See Also:
  - `XMLHandler.getXSIType()`

### handleObjectAttribs

protected void handleObjectAttribs(EObject obj)

Specified by:
  `handleObjectAttribs` in class `XMLHandler`
See Also:
  - `XMLHandler.handleObjectAttribs(org.eclipse.emf.ecore.EObject)`

### reflectiveCall

protected static Object reflectiveCall(String key, Object target, String methodName, Object... params)
Calls a given method through reflection after setting it `accessible`.

Parameters:
  `key` - The key of the bucket in which the Method object is stored within `METHOD_CACHE`.
  `target` - Target upon which we should invoke this method.
  `methodName` - Name of the method we are to call.
  `params` - Parameters of the invocation.
Returns:
  Result of the invocation.

### setField

protected static void setField(String fieldName, Object target, Object value)
Sets the given field through reflection after setting it `accessible`.

Parameters:
  `fieldName` - Name of the field we should set.
  `target` - The actual object which field we are to set.
  `value` - Value to which this field should be set.