Package xapi.fu
Interface Coercible
- All Known Subinterfaces:
Printable<Self>
- All Known Implementing Classes:
CharBuffer,Printable.SimplePrintable,PrintBuffer
public interface Coercible
-
Method Summary
Modifier and TypeMethodDescriptiondefault Stringcoerce(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.default Stringdefault Stringdefault StringcoerceNonArray(Object obj, boolean first) default booleanisAddNewlines(Object next) default Stringdefault String
-
Method Details
-
listSeparator
-
coerce
-
coerce
-
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 notobj- the object to coerce to a stringbefore- a supplier to print before the first item in a listafter- a supplier to print after the last item in a listnewline- 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
-
isAddNewlines
-
perIndent
-