org.treebind
Class TreeBom

java.lang.Object
  extended byorg.treebind.DefaultPipeElementImplementation
      extended byorg.treebind.DefaultFilterImplementation
          extended byorg.treebind.TreeBom
All Implemented Interfaces:
Filter, PipeElement, Sink, Source

public class TreeBom
extends DefaultFilterImplementation
implements Filter

A Filter implementation that keeps a copy of the Propertys that it receives and can pour them into a Sink again if needed. A TreeBom can be used as a Sink, ie without having a Sink attached and in that case it will just keep a copy of the properties to pour them when needed. TreeBom can also give you its root Property and, in this case it exposes the TreeBind Object Model justifying its name.

Author:
Eric van der Vlist
See Also:
Filter, Sink

Constructor Summary
TreeBom()
          Create a new TreeBom out of its pipe.
TreeBom(Pipe pipe)
          Create a TreeBom in its Pipe
 
Method Summary
 void addLeaf(Name role, Name nature, java.lang.Object value)
          Pour a new LeafProperty into the sink.
 void endProperty()
          Declares to the sink the end of the current ComplexProperty.
 Property getRoot()
          Get the TreeBom root property.
 void pour(Sink sink)
          Pours the TreeBom into a sink.
 void pour(Sink sink, Property property)
          Pours a property into the sink associated to the TreeBom.
 void startProperty(Name role, Name nature)
          Start pouring a new ComplexProperty into the sink.
 
Methods inherited from class org.treebind.DefaultFilterImplementation
convertNature, convertRole, getSink, setSink
 
Methods inherited from class org.treebind.DefaultPipeElementImplementation
getPipe, setPipe
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.treebind.Source
getSink, setSink
 
Methods inherited from interface org.treebind.PipeElement
getPipe, setPipe
 

Constructor Detail

TreeBom

public TreeBom()
Create a new TreeBom out of its pipe.


TreeBom

public TreeBom(Pipe pipe)
Create a TreeBom in its Pipe

Parameters:
pipe - the pipe
Method Detail

addLeaf

public void addLeaf(Name role,
                    Name nature,
                    java.lang.Object value)
             throws java.lang.Exception
Description copied from interface: Sink
Pour a new LeafProperty into the sink.

Specified by:
addLeaf in interface Sink
Overrides:
addLeaf in class DefaultFilterImplementation
Throws:
java.lang.Exception

endProperty

public void endProperty()
                 throws java.lang.Exception
Description copied from interface: Sink
Declares to the sink the end of the current ComplexProperty.

Specified by:
endProperty in interface Sink
Overrides:
endProperty in class DefaultFilterImplementation
Throws:
java.lang.Exception

getRoot

public Property getRoot()
Get the TreeBom root property.

Returns:
the root property

pour

public void pour(Sink sink)
          throws java.lang.Exception
Pours the TreeBom into a sink.

Parameters:
sink - the sink
Throws:
java.lang.Exception - if anything goes wrong

pour

public void pour(Sink sink,
                 Property property)
          throws java.lang.Exception
Pours a property into the sink associated to the TreeBom.

Parameters:
sink - the sink
property - the property
Throws:
java.lang.Exception - if anything goes wrong

startProperty

public void startProperty(Name role,
                          Name nature)
                   throws java.lang.Exception
Description copied from interface: Sink
Start pouring a new ComplexProperty into the sink.

Specified by:
startProperty in interface Sink
Overrides:
startProperty in class DefaultFilterImplementation
Throws:
java.lang.Exception