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
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final intstatic final int -
Constructor Summary
ConstructorsConstructorDescriptionPrettyPrinter(boolean allowUnsafeCalls) PrettyPrinter(boolean allowUnsafeCalls, int indentStringLength) -
Method Summary
Modifier and TypeMethodDescriptionprotected StringSubclasses can provide custom formatting for the given object.voidsetMaxArrayLength(int max) voidsetMaxCollectionLength(int max) voidsetMaxMapLength(int max) voidsetMaxStringLength(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
-