public class SerializerHelper extends Object
Constructor and Description |
---|
SerializerHelper()
Creates a new SerializerHelper.
|
Modifier and Type | Method and Description |
---|---|
protected ClassComparator |
getComparator()
Returns the class comparator instance used to find correct super classes.
|
static SerializerHelper |
getInstance()
Returns or creates a new SerializerHelper.
|
protected HashMap |
getMethods()
Returns the collection of all registered serialize methods.
|
protected SerializeMethod |
getSerializer(Class c)
Looks up the SerializeMethod for the given class or null if there is no SerializeMethod for the given class.
|
protected SerializeMethod |
getSuperClassObjectDescription(Class d)
Looks up the SerializeMethod for the given class or null if there is no SerializeMethod for the given class.
|
boolean |
isSerializable(Object o) |
Object |
readObject(ObjectInputStream in)
Reads the object from the object input stream.
|
void |
registerMethod(SerializeMethod method)
Registers a new SerializeMethod with this SerializerHelper.
|
protected void |
registerMethods()
Traverses the configuration and registers all serialization handlers in this factory.
|
void |
unregisterMethod(SerializeMethod method)
Deregisters a new SerializeMethod with this SerializerHelper.
|
void |
writeObject(Object o,
ObjectOutputStream out)
Writes a serializable object description to the given object output stream.
|
public static SerializerHelper getInstance()
public void registerMethod(SerializeMethod method)
method
- the method that should be registered.protected void registerMethods()
public void unregisterMethod(SerializeMethod method)
method
- the method that should be deregistered.protected HashMap getMethods()
protected ClassComparator getComparator()
protected SerializeMethod getSerializer(Class c)
c
- the class for which we want to lookup a serialize method.protected SerializeMethod getSuperClassObjectDescription(Class d)
d
- the class for which we want to lookup a serialize method.public void writeObject(Object o, ObjectOutputStream out) throws IOException
o
- the to be serialized object.out
- the outputstream that should receive the object.IOException
- if an I/O error occured.public boolean isSerializable(Object o)
public Object readObject(ObjectInputStream in) throws IOException, ClassNotFoundException
in
- the object input stream from where to read the serialized data.IOException
- if reading the stream failed.ClassNotFoundException
- if serialized object class cannot be found.Copyright © 2019 Hitachi Vantara. All rights reserved.