T - The format used to print the object's contentspublic abstract class ObjectPrinter<T>
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
protected java.util.List<PrintHandler<T>> |
m_handlers
A list of objects that handle the printing of objects of various
types
|
protected PrintHandler<T> |
m_reflectionHandler
The default handler to use when no other handler accepts an object
|
protected boolean |
m_usePrintable
Whether to use the
Readable interface when an object
implements it |
| Constructor and Description |
|---|
ObjectPrinter()
Creates a new object printer
|
| Modifier and Type | Method and Description |
|---|---|
T |
print(java.lang.Object o)
Serializes the contents of an object.
|
void |
reset()
Resets the state of the printer
|
boolean |
usesPrintable()
Tells whether the object printer uses the
Printable
interface when an object implements it |
abstract T |
wrap(java.lang.Object o,
T t)
Wraps an object into a structure that contains its type declaration
and its printed contents
|
protected java.util.List<PrintHandler<T>> m_handlers
protected PrintHandler<T> m_reflectionHandler
protected boolean m_usePrintable
Readable interface when an object
implements itpublic T print(java.lang.Object o) throws PrintException
Printable interface, it is serialized by calling its
print() method. Otherwise, the
serializer uses reflection to extract the object's fields and create
a key-value map of field names associated to their serialized contents.
In such a case, fields that are declared as transient in the
object are ignored.o - The objectPrintException - Thrown if an error occurs during the
serializationpublic abstract T wrap(java.lang.Object o, T t) throws PrintException
o - The objectt - The object's printed contentsPrintException - Thrown if the print operation caused an errorpublic void reset()
public boolean usesPrintable()
Printable
interface when an object implements itCopyright © Sylvain HallĂ©. All Rights Reserved.