Package org.biojava.bio.program.tagvalue
Class TagDelegator
java.lang.Object
org.biojava.bio.program.tagvalue.SimpleTagValueWrapper
org.biojava.bio.program.tagvalue.TagDelegator
- All Implemented Interfaces:
TagValueListener
,TagValueWrapper
Pushes a new parser and listener, or delegate to a listener depending on the tag.
setParserListener() is used to associate a tag with a TagValueParser and TagValueListener. When this tag is encountered, the pair will be pushed onto the parser processing stack and will gain control of the stream until that tag has ended. setListener() is used to associate a listener with a tag that will be used to handle those values without pushing a sub-context. The delegator is constructed with a default TagValueListener that will be informed of all events for which there are no explicit delegate pairs registered.
- Since:
- 1.2
- Author:
- Matthew Pocock
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
endTag()
End the current tag.getListener
(Object tag) getTags()
void
setDelegateParser
(TagValueParser delegateParser) void
setListener
(Object tag, TagValueListener listener) void
setParserListener
(Object tag, TagValueParser parser, TagValueListener listener) void
Start a new tag.void
value
(TagValueContext tvc, Object value) A value has been seen.Methods inherited from class org.biojava.bio.program.tagvalue.SimpleTagValueWrapper
endRecord, getDelegate, setDelegate, startRecord
-
Constructor Details
-
TagDelegator
public TagDelegator() -
TagDelegator
-
-
Method Details
-
setDelegateParser
-
getDelegateParser
-
startTag
Description copied from interface:TagValueListener
Start a new tag.- Specified by:
startTag
in interfaceTagValueListener
- Overrides:
startTag
in classSimpleTagValueWrapper
- Parameters:
tag
- the Object representing the new tag- Throws:
ParserException
- if the tag could not be started
-
endTag
Description copied from interface:TagValueListener
End the current tag.- Specified by:
endTag
in interfaceTagValueListener
- Overrides:
endTag
in classSimpleTagValueWrapper
- Throws:
ParserException
- if the tag could not be ended
-
value
Description copied from interface:TagValueListener
A value has been seen.- Specified by:
value
in interfaceTagValueListener
- Overrides:
value
in classSimpleTagValueWrapper
- Parameters:
tvc
- a TagValueContext that could be used to push a sub-documentvalue
- the value Object observed- Throws:
ParserException
- if the value could not be processed
-
setParserListener
-
setListener
-
getParser
-
getListener
-
getTags
-