Package com.pnfsoftware.jeb.util.format
Class PrettyPrinter
java.lang.Object
com.pnfsoftware.jeb.util.format.PrettyPrinter
The pretty-printer object does its best to provide a human-readable representation of any object.
Elements of arrays, collections, and maps are rendered individually. For non-basic types,
toString
is called, unless forbidden (see `allowCallToString`) or customized (see
formatObject(Object)
). For maps, the key-value pairs are rendered one per line line.
Indenting uses 2 white-space characters.-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
static final int
static final int
static final int
-
Constructor Summary
ConstructorDescriptionPrettyPrinter
(boolean allowUnsafeCalls) PrettyPrinter
(boolean allowUnsafeCalls, int indentStringLength) -
Method Summary
Modifier and TypeMethodDescriptionprotected String
Subclasses can provide custom formatting for the given object.void
setMaxArrayLength
(int max) void
setMaxCollectionLength
(int max) void
setMaxMapLength
(int max) void
setMaxStringLength
(int max)
-
Field Details
-
DEFAULT_MAX_STRING_LENGTH
public static final int DEFAULT_MAX_STRING_LENGTH- See Also:
-
DEFAULT_MAX_ARRAY_ITEM_COUNT
public static final int DEFAULT_MAX_ARRAY_ITEM_COUNT- See Also:
-
DEFAULT_MAX_COLLECTION_ITEM_COUNT
public static final int DEFAULT_MAX_COLLECTION_ITEM_COUNT- See Also:
-
DEFAULT_MAX_MAP_ITEM_COUNT
public static final int DEFAULT_MAX_MAP_ITEM_COUNT- See Also:
-
-
Constructor Details
-
PrettyPrinter
public PrettyPrinter(boolean allowUnsafeCalls, int indentStringLength) -
PrettyPrinter
public PrettyPrinter(boolean allowUnsafeCalls) -
PrettyPrinter
public PrettyPrinter()
-
-
Method Details
-
setMaxStringLength
public void setMaxStringLength(int max) -
setMaxArrayLength
public void setMaxArrayLength(int max) -
setMaxCollectionLength
public void setMaxCollectionLength(int max) -
setMaxMapLength
public void setMaxMapLength(int max) -
format
-
formatObject
Subclasses can provide custom formatting for the given object.- Parameters:
o
-- Returns:
- a string or null to let the pretty-printer proceed with its own implementation
-