public class

PrettyPrinter

extends Object
java.lang.Object
   ↳ com.pnfsoftware.jeb.util.format.PrettyPrinter

Class Overview

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.

Summary

Constants
int DEFAULT_MAX_ARRAY_ITEM_COUNT
int DEFAULT_MAX_COLLECTION_ITEM_COUNT
int DEFAULT_MAX_MAP_ITEM_COUNT
int DEFAULT_MAX_STRING_LENGTH
Public Constructors
PrettyPrinter(boolean allowUnsafeCalls, int indentStringLength)
PrettyPrinter(boolean allowUnsafeCalls)
PrettyPrinter()
Public Methods
String format(Object o)
void setMaxArrayLength(int max)
void setMaxCollectionLength(int max)
void setMaxMapLength(int max)
void setMaxStringLength(int max)
Protected Methods
String formatObject(Object o)
Subclasses can provide custom formatting for the given object.
[Expand]
Inherited Methods
From class java.lang.Object

Constants

public static final int DEFAULT_MAX_ARRAY_ITEM_COUNT

Constant Value: 40 (0x00000028)

public static final int DEFAULT_MAX_COLLECTION_ITEM_COUNT

Constant Value: 40 (0x00000028)

public static final int DEFAULT_MAX_MAP_ITEM_COUNT

Constant Value: 40 (0x00000028)

public static final int DEFAULT_MAX_STRING_LENGTH

Constant Value: 200 (0x000000c8)

Public Constructors

public PrettyPrinter (boolean allowUnsafeCalls, int indentStringLength)

public PrettyPrinter (boolean allowUnsafeCalls)

public PrettyPrinter ()

Public Methods

public String format (Object o)

public void setMaxArrayLength (int max)

public void setMaxCollectionLength (int max)

public void setMaxMapLength (int max)

public void setMaxStringLength (int max)

Protected Methods

protected String formatObject (Object o)

Subclasses can provide custom formatting for the given object.

Returns
  • a string or null to let the pretty-printer proceed with its own implementation