Package org.biojava.bio.program.tagvalue
Class SimpleTagValueWrapper
java.lang.Object
org.biojava.bio.program.tagvalue.SimpleTagValueWrapper
- All Implemented Interfaces:
TagValueListener,TagValueWrapper
- Direct Known Subclasses:
Aggregator,MultiTagger,RegexFieldFinder,TagDelegator,TagDropper,TagRenamer,ValueChanger
Helper class to wrap one TagValueListener inside another one.
Implementations will tend to intercept the tags or values as they stream through and modify them in some manner before forwarding them to the delegate listener. Using classes derived from SimpleTagValueWrapper, it is possible to build up complex chains of handlers that process and collate information as it streams through.
- Since:
- 1.2
- Author:
- Matthew Pocock, David Huen (change of TagValueWrapper to interface)
-
Constructor Summary
ConstructorsConstructorDescriptionSimpleTagValueWrapper(TagValueListener delegate) Build a SimpleTagValueWrapper that will forward everything to a delegate. -
Method Summary
Modifier and TypeMethodDescriptionvoidThe current record has ended.voidendTag()End the current tag.get listener to which all calls will be delegatedvoidsetDelegate(TagValueListener delegate) set listener to which all calls will be delegatedvoidA new record is about to start.voidStart a new tag.voidvalue(TagValueContext ctxt, Object value) A value has been seen.
-
Constructor Details
-
SimpleTagValueWrapper
Build a SimpleTagValueWrapper that will forward everything to a delegate.- Parameters:
delegate- the SimpleTagValueWrapper to forward events to
-
SimpleTagValueWrapper
public SimpleTagValueWrapper()
-
-
Method Details
-
getDelegate
Description copied from interface:TagValueWrapperget listener to which all calls will be delegated- Specified by:
getDelegatein interfaceTagValueWrapper
-
setDelegate
Description copied from interface:TagValueWrapperset listener to which all calls will be delegated- Specified by:
setDelegatein interfaceTagValueWrapper
-
startRecord
Description copied from interface:TagValueListenerA new record is about to start.- Specified by:
startRecordin interfaceTagValueListener- Throws:
ParserException- if the record can not be started
-
endRecord
Description copied from interface:TagValueListenerThe current record has ended.- Specified by:
endRecordin interfaceTagValueListener- Throws:
ParserException- if the record can not be ended
-
startTag
Description copied from interface:TagValueListenerStart a new tag.- Specified by:
startTagin interfaceTagValueListener- Parameters:
tag- the Object representing the new tag- Throws:
ParserException- if the tag could not be started
-
endTag
Description copied from interface:TagValueListenerEnd the current tag.- Specified by:
endTagin interfaceTagValueListener- Throws:
ParserException- if the tag could not be ended
-
value
Description copied from interface:TagValueListenerA value has been seen.- Specified by:
valuein interfaceTagValueListener- Parameters:
ctxt- a TagValueContext that could be used to push a sub-documentvalue- the value Object observed- Throws:
ParserException- if the value could not be processed
-