T - The format to which the object has been writtenpublic abstract class ObjectReader<T>
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
protected java.util.Set<java.lang.ClassLoader> |
m_classLoaders
Additional class loaders
|
protected java.util.List<ReadHandler<T>> |
m_handlers
A list of objects that handle the printing of objects of various
types
|
protected ReadHandler<T> |
m_reflectionHandler
The default handler to use when no other accepts an object
|
| Constructor and Description |
|---|
ObjectReader()
Creates a new object reader
|
| Modifier and Type | Method and Description |
|---|---|
void |
addClassLoader(java.lang.ClassLoader cl)
Adds a new class loader used to create new class instances
|
java.lang.Class<?> |
findClass(java.lang.String class_name)
Finds a class by its name
|
java.lang.Object |
getInstance(java.lang.Class<?> clazz)
Produces an instance of an object based on its deserialized contents
and a target class.
|
protected abstract boolean |
isWrapped(java.lang.Object t) |
java.lang.Object |
read(java.lang.Object t)
Deserializes the content of an object
|
static void |
setField(java.lang.Object o,
java.lang.String field_name,
java.lang.Object value)
Sets the value of a field in an object
|
protected abstract java.lang.Object |
unwrapContents(java.lang.Object t) |
protected abstract java.lang.Class<?> |
unwrapType(java.lang.Object t) |
protected java.util.Set<java.lang.ClassLoader> m_classLoaders
protected java.util.List<ReadHandler<T>> m_handlers
protected ReadHandler<T> m_reflectionHandler
public java.lang.Object read(java.lang.Object t)
throws ReadException
t - The serialized contents of the objectReadException - Thrown if deserialization produced an errorprotected abstract java.lang.Class<?> unwrapType(java.lang.Object t)
throws ReadException
ReadExceptionprotected abstract java.lang.Object unwrapContents(java.lang.Object t)
throws ReadException
ReadExceptionprotected abstract boolean isWrapped(java.lang.Object t)
public java.lang.Object getInstance(java.lang.Class<?> clazz)
throws ReadException
newInstance() method.clazz - The target class for the objectReadException - If the operation cannot be carried onpublic void addClassLoader(java.lang.ClassLoader cl)
cl - The class loaderpublic java.lang.Class<?> findClass(java.lang.String class_name)
throws java.lang.ClassNotFoundException
class_name - The name of the classjava.lang.ClassNotFoundException - Thrown if the class could not be foundpublic static void setField(java.lang.Object o,
java.lang.String field_name,
java.lang.Object value)
throws ReadException
o - The objectfield_name - The name of the field to setvalue - The value to setReadException - Thrown if the value cannot be assigned to this fieldCopyright © Sylvain HallĂ©. All Rights Reserved.