T - The type to which objects are serializedpublic class ReflectionPrintHandler<T> extends java.lang.Object implements PrintHandler<T>
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
m_ignoreTransient
Whether the fields marked as transient should be ignored
|
protected ObjectPrinter<T> |
m_printer
The internal object printer
|
| Constructor and Description |
|---|
ReflectionPrintHandler(ObjectPrinter<T> p)
Creates a new reflection print handler
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
canHandle(java.lang.Object o)
Indicates whether this handler can take care of printing a particular
object.
|
protected T |
encapsulateFields(java.lang.Object o,
java.util.Map<java.lang.String,java.lang.Object> contents) |
protected static java.util.List<java.lang.reflect.Field> |
getAllFields(java.lang.Class<?> type) |
protected static java.util.List<java.lang.reflect.Field> |
getAllFields(java.util.List<java.lang.reflect.Field> fields,
java.lang.Class<?> type) |
protected static java.lang.reflect.Field |
getFromAllFields(java.lang.String name,
java.lang.Class<?> type) |
T |
handle(java.lang.Object o)
Prints an object
|
void |
reset()
Resets the internal state of the handler
|
protected ObjectPrinter<T> m_printer
protected boolean m_ignoreTransient
public ReflectionPrintHandler(ObjectPrinter<T> p)
p - The internal object printerpublic boolean canHandle(java.lang.Object o)
PrintHandlercanHandle in interface PrintHandler<T>o - The objectpublic T handle(java.lang.Object o) throws PrintException
PrintHandlerhandle in interface PrintHandler<T>o - The object to be printedPrintException - Thrown if the object cannot be printedprotected T encapsulateFields(java.lang.Object o, java.util.Map<java.lang.String,java.lang.Object> contents) throws PrintException
PrintExceptionprotected static java.util.List<java.lang.reflect.Field> getAllFields(java.util.List<java.lang.reflect.Field> fields,
java.lang.Class<?> type)
protected static java.util.List<java.lang.reflect.Field> getAllFields(java.lang.Class<?> type)
protected static java.lang.reflect.Field getFromAllFields(java.lang.String name,
java.lang.Class<?> type)
throws java.lang.NoSuchFieldException
java.lang.NoSuchFieldExceptionpublic void reset()
PrintHandlerreset in interface PrintHandler<T>Copyright © Sylvain HallĂ©. All Rights Reserved.