TagDelegator (BioJava-1.5-beta API)
Keywords: org.biojava.bio.program.tagvalue.TagDelegator class

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## 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

    public class TagDelegator

extends SimpleTagValueWrapper

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
`TagDelegator()`
`TagDelegator(TagValueListener delegate)`

Method Summary
`void` | `endTag()` End the current tag.
`TagValueParser` | `getDelegateParser()`
`TagValueListener` | `getListener(Object tag)`
`TagValueParser` | `getParser(Object tag)`
`Set` | `getTags()`
`void` | `setDelegateParser(TagValueParser delegateParser)`
`void` | `setListener(Object tag, TagValueListener listener)`
`void` | `setParserListener(Object tag, TagValueParser parser, TagValueListener listener)`
`void` | `startTag(Object tag)` 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`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### TagDelegator

    public TagDelegator()

### TagDelegator

    public TagDelegator(TagValueListener delegate)

Method Detail

### setDelegateParser

    public void setDelegateParser(TagValueParser delegateParser)

### getDelegateParser

    public TagValueParser getDelegateParser()

### startTag

    public void startTag(Object tag)
                  throws ParserException

  Description copied from interface: `TagValueListener`
  Start a new tag.

  Specified by:
    `startTag` in interface `TagValueListener`
  Overrides:
    `startTag` in class `SimpleTagValueWrapper`
  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`
  Overrides:
    `endTag` in class `SimpleTagValueWrapper`
  Throws:
    `ParserException` - if the tag could not be ended

### value

    public void value(TagValueContext tvc,
                      Object value)
               throws ParserException

  Description copied from interface: `TagValueListener`
  A value has been seen.

  Specified by:
    `value` in interface `TagValueListener`
  Overrides:
    `value` in class `SimpleTagValueWrapper`
  Parameters:
    `tvc` - 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

### setParserListener

    public void setParserListener(Object tag,
                                  TagValueParser parser,
                                  TagValueListener listener)

### setListener

    public void setListener(Object tag,
                            TagValueListener listener)

### getParser

    public TagValueParser getParser(Object tag)

### getListener

    public TagValueListener getListener(Object tag)

### getTags

    public Set getTags()

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD