Package xapi.fu

Interface Coercible

All Known Subinterfaces:
Printable<Self>
All Known Implementing Classes:
CharBuffer, Printable.SimplePrintable, PrintBuffer

public interface Coercible
  • Method Details

    • listSeparator

      default String listSeparator()
    • coerce

      default String coerce(Object obj)
    • coerce

      default String coerce(Object obj, boolean first)
    • coerce

      default String coerce(boolean first, Object obj, Supplier<String> before, Supplier<String> after, Supplier<String> newline, Supplier<String> emptyString)
      All other coerce methods funnel to here, where we handle iterables and arrays, along with escaping those list items. You should only override this method if you want direct access to iterables before they are unwrapped. If you want this high-levels of control, it comes at the cost of a higher complexity method signature.
      Parameters:
      first - whether this is the first item in a list or not
      obj - the object to coerce to a string
      before - a supplier to print before the first item in a list
      after - a supplier to print after the last item in a list
      newline - a supplier providing newline (and optional indents)
      emptyString - a supplier providing the "empty string" value (not really used in this adaptation)
      Returns:
      A nicely format "stringified" version of supplied object.
    • coerceNonArray

      default String coerceNonArray(Object obj, boolean first)
    • isAddNewlines

      default boolean isAddNewlines(Object next)
    • perIndent

      default String perIndent()