org.treebind
Class JavaObjectSink

java.lang.Object
  extended byorg.treebind.DefaultPipeElementImplementation
      extended byorg.treebind.JavaObjectSink
All Implemented Interfaces:
PipeElement, Sink

public class JavaObjectSink
extends DefaultPipeElementImplementation
implements Sink

Sink designed create Java objects.

Author:
vdv
See Also:
Sink

Constructor Summary
JavaObjectSink()
          Creates a new JavaObjectSink.
JavaObjectSink(Pipe pipe)
          Creates a new JavaObjectSink embedded in a pipe.
 
Method Summary
 java.lang.String adderName(Name name)
          Method used internally to define the "adder" name for a property.
 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.
 java.lang.String genericAdderName(Name name)
          Method used internally to define the name of a generic "adder" method.
 java.lang.Object getObject()
          Get the top level object created by the sink.
 java.lang.String setterName(Name name)
          Method used internally to define the "setter" name for a property.
 void startProperty(Name role, Name nature)
          Start pouring a new ComplexProperty into the sink.
 
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.PipeElement
getPipe, setPipe
 

Constructor Detail

JavaObjectSink

public JavaObjectSink()
Creates a new JavaObjectSink.


JavaObjectSink

public JavaObjectSink(Pipe pipe)
Creates a new JavaObjectSink embedded in a pipe.

Parameters:
pipe - the pipe containing the JavaObjectSink.
Method Detail

adderName

public java.lang.String adderName(Name name)
Method used internally to define the "adder" name for a property. Can be overiden to change the standard policy which is to add a "add" prefix to the local name.

Parameters:
name - a property name.
Returns:
the name of the "setter" method for that property.

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
Parameters:
role - role the role of the property
nature - nature the nature of the property
value - value of the property
Throws:
java.lang.Exception - when anything goes wrong

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
Throws:
java.lang.Exception - when anything goes wrong

genericAdderName

public java.lang.String genericAdderName(Name name)
Method used internally to define the name of a generic "adder" method. Can be overiden to change the standard policy which is to return "add".

Returns:
the name of the generic "adder" method.

getObject

public java.lang.Object getObject()
Get the top level object created by the sink.

Returns:
the top level object.

setterName

public java.lang.String setterName(Name name)
Method used internally to define the "setter" name for a property. Can be overiden to change the standard policy which is to add a "set" prefix to the local name.

Parameters:
name - a property name.
Returns:
the name of the "setter" method for that property.

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
Parameters:
role - the role of the property
nature - the nature of the property
Throws:
java.lang.Exception - when anything goes wrong