biz.c24.io.api.presentation
Class JavaClassSink

java.lang.Object
  extended by biz.c24.io.api.presentation.Sink
      extended by biz.c24.io.api.presentation.JavaClassSink
All Implemented Interfaces:
Serializable, Cloneable

public class JavaClassSink
extends Sink

A sink for generating java class instances from data objects.

Note that this implementation is not synchronized. If multiple threads use an instance concurrently, it must be synchronized externally.

See Also:
Sink, Serialized Form

Constructor Summary
JavaClassSink()
          Constructs a new instance.
JavaClassSink(JavaClassSink clone)
          Constructs a new instance cloned from clone.
JavaClassSink(OutputStream stream)
          Constructs a new instance which will write to stream.
 
Method Summary
 Object clone()
           
 Object convertObject(ComplexDataObject cdo)
          Converts the specified object back to its original form, skipping the serialization and streaming steps.
 Class getRootClass()
          Returns the root class.
 void setRootClass(Class rootClazz)
          Sets the root class.
 void setWriter(Writer writer)
          Sets the writer (optional operation).
 void writeObject(ComplexDataObject obj)
          Writes an object to the writer or output stream that has been set.
 
Methods inherited from class biz.c24.io.api.presentation.Sink
checkInit, clearBatchIterators, getEncoding, getOutputStream, getWriter, registerBatchIterator, setEncoding, setOutputStream, stream, unregisterBatchIterator, writer
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JavaClassSink

public JavaClassSink()
Constructs a new instance.


JavaClassSink

public JavaClassSink(JavaClassSink clone)
Constructs a new instance cloned from clone.

Parameters:
clone - The instance to clone.

JavaClassSink

public JavaClassSink(OutputStream stream)
Constructs a new instance which will write to stream.

Parameters:
stream - The stream to write the java class instances to.
Method Detail

getRootClass

public Class getRootClass()
Returns the root class.

Returns:
The root class.

setRootClass

public void setRootClass(Class rootClazz)
Sets the root class.

Parameters:
rootClazz - The root class.

setWriter

public void setWriter(Writer writer)
Description copied from class: Sink
Sets the writer (optional operation).

Overrides:
setWriter in class Sink
Parameters:
writer - The new value.

writeObject

public void writeObject(ComplexDataObject obj)
                 throws IOException
Description copied from class: Sink
Writes an object to the writer or output stream that has been set.

Specified by:
writeObject in class Sink
Parameters:
obj - The object to be written.
Throws:
IOException - If the complete object could not be written for any reason.

convertObject

public Object convertObject(ComplexDataObject cdo)
                     throws IOException
Converts the specified object back to its original form, skipping the serialization and streaming steps.

Parameters:
cdo - The object to be written.
Returns:
The new object.
Throws:
IOException - If the complete object could not be written for any reason.
IllegalStateException - If neither a writer nor an output stream has been set.

clone

public Object clone()
Specified by:
clone in class Sink


C24 Technologies © 2002-2012: All Rights Reserved.