biz.c24.io.api.presentation
Class JavaClassSource

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

public class JavaClassSource
extends Source

A source for generating data objects from java class instances.

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

See Also:
Serialized Form

Constructor Summary
JavaClassSource()
          Constructs a new instance.
JavaClassSource(InputStream stream)
          Constructs a new instance which will read from stream.
JavaClassSource(JavaClassSource clone)
          Constructs a new instance cloned from clone.
 
Method Summary
 Object clone()
           
 ComplexDataObject convertObject(Element element, Object obj)
          Converts obj to a complex data object directly, skipping the serialization and streaming steps.
 ClassLoader getClassLoader()
          Returns the class loader used to deserialize the java objects

If this property has not been set explicitly then the class loader used to load this class is returned.

 void readObject(ComplexDataObject cdo)
          Reads an object from the the reader or input stream that has been set (optional operation).
 ComplexDataObject readObject(Element element)
          Reads an object from the the reader or input stream that has been set.
 void setClassLoader(ClassLoader classLoader)
          Sets the class loader to use when deserializing java objects.
 void setReader(Reader reader)
          Unsupported operation, use Source.setInputStream(InputStream) instead.
 
Methods inherited from class biz.c24.io.api.presentation.Source
checkInit, getEncoding, getInputStream, getMarkableInputStream, getParseListener, getReader, getSystemId, reader, ready, setEncoding, setInputStream, setInputStream, setParseListener, setReader, setSystemId, stream
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JavaClassSource

public JavaClassSource()
Constructs a new instance.


JavaClassSource

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

Parameters:
clone - The instance to clone.

JavaClassSource

public JavaClassSource(InputStream stream)
Constructs a new instance which will read from stream.

Parameters:
stream - The stream to read the data from.
Method Detail

setReader

public void setReader(Reader reader)
Unsupported operation, use Source.setInputStream(InputStream) instead.

Overrides:
setReader in class Source
Parameters:
reader - The new value.

setClassLoader

public void setClassLoader(ClassLoader classLoader)
Sets the class loader to use when deserializing java objects.

Parameters:
classLoader - The class loader.

getClassLoader

public ClassLoader getClassLoader()
Returns the class loader used to deserialize the java objects

If this property has not been set explicitly then the class loader used to load this class is returned.

Returns:
The class loader.

readObject

public ComplexDataObject readObject(Element element)
                             throws IOException
Description copied from class: Source
Reads an object from the the reader or input stream that has been set.

Specified by:
readObject in class Source
Parameters:
element - The element declaration to which the input data is expected to adhere.
Returns:
The newly created object.
Throws:
IOException - If the complete object could not be read for any reason.

readObject

public void readObject(ComplexDataObject cdo)
                throws IOException
Description copied from class: Source
Reads an object from the the reader or input stream that has been set (optional operation).

Specified by:
readObject in class Source
Parameters:
cdo - The object into which the input data should be parsed.
Throws:
IOException - If the complete object could not be read for any reason.

convertObject

public ComplexDataObject convertObject(Element element,
                                       Object obj)
                                throws IOException
Converts obj to a complex data object directly, skipping the serialization and streaming steps.

Parameters:
element - The element declaration to which the source object is expected to adhere.
obj - The source object to be converted.
Returns:
The newly created object.
Throws:
IOException - If the complete object could not be read for any reason.

clone

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


C24 Technologies © 2002-2012: All Rights Reserved.