Package org.approvej.print
Class ObjectPrinter<T>
java.lang.Object
org.approvej.print.ObjectPrinter<T>
- Type Parameters:
T- the type of the object to be printed
A generic printer for Java
Objects that prints their properties and values one per line.-
Field Summary
FieldsFields inherited from interface org.approvej.print.Printer
DEFAULT_FILENAME_EXTENSION -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> ObjectPrinter<T> Creates a newObjectPrinterinstance.sorted()Causes thePrinterto sort the printed object's fields by their name.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.approvej.print.Printer
filenameExtension
-
Field Details
-
SIMPLE_TYPES
ASetof classes that will be printed directly.
-
-
Constructor Details
-
ObjectPrinter
public ObjectPrinter()Creates a newObjectPrinterinstance that prints the given object.This constructor is public to allow instantiation via reflection, e.g. in the
Configurationclass.
-
-
Method Details
-
objectPrinter
Creates a newObjectPrinterinstance.- Type Parameters:
T- the type of the object to be printed- Returns:
- a new
ObjectPrinterinstance
-
sorted
Causes thePrinterto sort the printed object's fields by their name. By default, the fields will be printed in the order of their declaration.- Returns:
- this
-
apply
-