|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.mit.jverbnet.util.parse.LazyForwardingHandler<T>
public abstract class LazyForwardingHandler<T>
A handler that does not instantiate its backing handler until the backing handler is actually needed. This class is useful for handling potentially infinitely recursive XML structures.
Nested Class Summary | |
---|---|
protected class |
LazyForwardingHandler.ForwardingTaskList
This task list keeps track of tasks before the backing handler is instantiated. |
Constructor Summary | |
---|---|
LazyForwardingHandler(IHasParserHandler parent,
java.lang.String tag)
Creates a new lazy forwarding handler with the specified parent and tag. |
|
LazyForwardingHandler(java.lang.String tag)
Creates a new lazy forwarding handler that uses the specified tag. |
|
LazyForwardingHandler(org.xml.sax.XMLReader parser,
org.xml.sax.ContentHandler parent,
java.lang.String tag)
Creates a new lazy forwarding handler with the specified parser, parent and tag. |
|
LazyForwardingHandler(org.xml.sax.XMLReader parser,
java.lang.String tag)
Creates a new lazy forwarding handler with the specified parser and tag. |
Method Summary | |
---|---|
void |
characters(char[] ch,
int start,
int length)
|
void |
clear()
Clears the state of the handler. |
protected abstract ITaggedHandler<T> |
createBackingHandler()
Subclasses should implement this method to create the backing handler. |
void |
endDocument()
|
void |
endElement(java.lang.String uri,
java.lang.String localName,
java.lang.String qName)
|
void |
endPrefixMapping(java.lang.String prefix)
|
ITaggedHandler<T> |
getBackingHandler()
Returns the backing handler, instantiating it if necessary. |
T |
getElement()
Returns the object representing the data in the parsed tagged block. |
org.xml.sax.ContentHandler |
getParent()
Returns the parent of this child handler. |
org.xml.sax.XMLReader |
getParser()
Returns the parser for this handler. |
java.lang.String |
getTag()
Returns the tag that is handled by this handler. |
java.util.List<ITaggedBlockTaskHandler> |
getTaggedBlockTasks()
Returns the list of task handlers that are run when the tagged block is entered and exited. |
void |
ignorableWhitespace(char[] ch,
int start,
int length)
|
void |
processingInstruction(java.lang.String target,
java.lang.String data)
|
void |
setDocumentLocator(org.xml.sax.Locator locator)
|
void |
setParent(org.xml.sax.ContentHandler parent)
Sets the parent for this handler. |
void |
setParser(org.xml.sax.XMLReader parser)
Sets the parser for this handler; may be set to null |
void |
skippedEntity(java.lang.String name)
|
void |
startDocument()
|
void |
startElement(java.lang.String uri,
java.lang.String localName,
java.lang.String qName,
org.xml.sax.Attributes atts)
|
void |
startPrefixMapping(java.lang.String prefix,
java.lang.String uri)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public LazyForwardingHandler(java.lang.String tag)
tag
- the tag for the block that this handler handles; may not be
null
, empty, or all whitespace.
java.lang.NullPointerException
- if the specified tag is null
java.lang.IllegalArgumentException
- if the specified tag is empty or all whitespacepublic LazyForwardingHandler(org.xml.sax.XMLReader parser, java.lang.String tag)
parser
- the parser for this handler; may be null
tag
- the tag for the block that this handler handles; may not be
null
, empty, or all whitespace.
java.lang.NullPointerException
- if the specified tag is null
java.lang.IllegalArgumentException
- if the specified tag is empty or all whitespacepublic LazyForwardingHandler(IHasParserHandler parent, java.lang.String tag)
parent
- this handler's parent; may be null
tag
- the tag for the block that this handler handles; may not be
null
, empty, or all whitespace.
java.lang.NullPointerException
- if the specified tag is null
java.lang.IllegalArgumentException
- if the specified tag is empty or all whitespacepublic LazyForwardingHandler(org.xml.sax.XMLReader parser, org.xml.sax.ContentHandler parent, java.lang.String tag)
parser
- the parser for this handler; may be null
parent
- this handler's parent; may be null
tag
- the tag for the block that this handler handles; may not be
null
, empty, or all whitespace.
java.lang.NullPointerException
- if the specified tag is null
java.lang.IllegalArgumentException
- if the specified tag is empty or all whitespaceMethod Detail |
---|
public final ITaggedHandler<T> getBackingHandler()
protected abstract ITaggedHandler<T> createBackingHandler()
public void setDocumentLocator(org.xml.sax.Locator locator)
setDocumentLocator
in interface org.xml.sax.ContentHandler
public org.xml.sax.XMLReader getParser()
IHasParserHandler
null
.
getParser
in interface IHasParserHandler
null
parser for this handlerpublic void setParser(org.xml.sax.XMLReader parser)
IHasParserHandler
null
setParser
in interface IHasParserHandler
parser
- the new parser for this handler; may be null
public java.lang.String getTag()
ITaggedHandler
null
or empty, and will be trimmed of leading and trailing
whitespace.
getTag
in interface ITaggedHandler<T>
null
, non-empty, trimmed tag that is handled
by this handlerpublic org.xml.sax.ContentHandler getParent()
ITaggedHandler
null
.
getParent
in interface ITaggedHandler<T>
null
parent of this child handlerpublic void setParent(org.xml.sax.ContentHandler parent)
ITaggedHandler
null
setParent
in interface ITaggedHandler<T>
parent
- the new parent for the handler; may be null
public java.util.List<ITaggedBlockTaskHandler> getTaggedBlockTasks()
ITaggedHandler
getTaggedBlockTasks
in interface ITaggedHandler<T>
public void clear()
ITaggedHandler
clear
in interface ITaggedHandler<T>
public T getElement()
ITaggedHandler
getElement
in interface ITaggedHandler<T>
public void startDocument() throws org.xml.sax.SAXException
startDocument
in interface org.xml.sax.ContentHandler
org.xml.sax.SAXException
public void endDocument() throws org.xml.sax.SAXException
endDocument
in interface org.xml.sax.ContentHandler
org.xml.sax.SAXException
public void startPrefixMapping(java.lang.String prefix, java.lang.String uri) throws org.xml.sax.SAXException
startPrefixMapping
in interface org.xml.sax.ContentHandler
org.xml.sax.SAXException
public void endPrefixMapping(java.lang.String prefix) throws org.xml.sax.SAXException
endPrefixMapping
in interface org.xml.sax.ContentHandler
org.xml.sax.SAXException
public void startElement(java.lang.String uri, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes atts) throws org.xml.sax.SAXException
startElement
in interface org.xml.sax.ContentHandler
org.xml.sax.SAXException
public void endElement(java.lang.String uri, java.lang.String localName, java.lang.String qName) throws org.xml.sax.SAXException
endElement
in interface org.xml.sax.ContentHandler
org.xml.sax.SAXException
public void characters(char[] ch, int start, int length) throws org.xml.sax.SAXException
characters
in interface org.xml.sax.ContentHandler
org.xml.sax.SAXException
public void ignorableWhitespace(char[] ch, int start, int length) throws org.xml.sax.SAXException
ignorableWhitespace
in interface org.xml.sax.ContentHandler
org.xml.sax.SAXException
public void processingInstruction(java.lang.String target, java.lang.String data) throws org.xml.sax.SAXException
processingInstruction
in interface org.xml.sax.ContentHandler
org.xml.sax.SAXException
public void skippedEntity(java.lang.String name) throws org.xml.sax.SAXException
skippedEntity
in interface org.xml.sax.ContentHandler
org.xml.sax.SAXException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |