org.biojava.bio.program.tagvalue
Class TagValueWrapper

java.lang.Object
  extended byorg.biojava.bio.program.tagvalue.TagValueWrapper
All Implemented Interfaces:
TagValueListener
Direct Known Subclasses:
RegexFieldFinder, TagDelegator, TagDropper, TagRenamer, ValueChanger

public abstract class TagValueWrapper
extends java.lang.Object
implements TagValueListener

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 TagValueWrapper, 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

Constructor Summary
TagValueWrapper()
           
TagValueWrapper(TagValueListener delegate)
          Build a TagValueWrapper that will forward everything to a delegate.
 
Method Summary
 void endRecord()
          The current record has ended.
 void endTag()
          End the current tag.
 TagValueListener getDelegate()
           
 void setDelegate(TagValueListener delegate)
           
 void startRecord()
          A new record is about to start.
 void startTag(java.lang.Object tag)
          Start a new tag.
 void value(TagValueContext ctxt, java.lang.Object value)
          A value has been seen.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TagValueWrapper

public TagValueWrapper(TagValueListener delegate)
Build a TagValueWrapper that will forward everything to a delegate.

Parameters:
delegate - the TagValueWrapper to forward events to

TagValueWrapper

public TagValueWrapper()
Method Detail

getDelegate

public TagValueListener getDelegate()

setDelegate

public void setDelegate(TagValueListener delegate)

startRecord

public void startRecord()
                 throws ParserException
Description copied from interface: TagValueListener
A new record is about to start.

Specified by:
startRecord in interface TagValueListener
Throws:
ParserException - if the record can not be started

endRecord

public void endRecord()
               throws ParserException
Description copied from interface: TagValueListener
The current record has ended.

Specified by:
endRecord in interface TagValueListener
Throws:
ParserException - if the record can not be ended

startTag

public void startTag(java.lang.Object tag)
              throws ParserException
Description copied from interface: TagValueListener
Start a new tag.

Specified by:
startTag in interface TagValueListener
Parameters:
tag - the Object representing the new tag
Throws:
ParserException - if the tag could not be started

endTag

public void endTag()
            throws ParserException
Description copied from interface: TagValueListener
End the current tag.

Specified by:
endTag in interface TagValueListener
Throws:
ParserException - if the tag could not be ended

value

public void value(TagValueContext ctxt,
                  java.lang.Object value)
           throws ParserException
Description copied from interface: TagValueListener
A value has been seen.

Specified by:
value in interface TagValueListener
Parameters:
ctxt - a TagValueContext that could be used to push a sub-document
value - the value Object observed
Throws:
ParserException - if the value could not be processed