Class PrettyPrinter

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

public class PrettyPrinter extends Object
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 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

      public String format(Object o)
    • formatObject

      protected String formatObject(Object o)
      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