us.bpsm.edn.printer
Class Printers
- java.lang.Object
-
- us.bpsm.edn.printer.Printers
-
public class Printers extends java.lang.ObjectFactory for creatingPrinters and related Objects.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method and Description static Protocol<Printer.Fn<?>>defaultPrinterProtocol()Return the default printerProtocol.static Protocol.Builder<Printer.Fn<?>>defaultProtocolBuilder()Returns aProtocol.Builderpreconfigured knowing how to print classes known to end-java:BigDecimalBigIntegerBooleanByte(as an integer)CharSequence(as a string literal)Character(as a character literal)Date(as#inst)DoubleFloatGregorianCalendar(as#inst)IntegerKeywordListLongMapSetShort(as an integer)SymbolTagTaggedValueTimestamp(as#inst)UUID(as#uuid)static PrinternewPrinter(java.lang.Appendable out)Return a new Printer with the default printing protocol.static PrinternewPrinter(Protocol<Printer.Fn<?>> fns, java.lang.Appendable out)Return a new Printer with the printing protocol given asfns.static Protocol<Printer.Fn<?>>prettyPrinterProtocol()static Protocol.Builder<Printer.Fn<?>>prettyProtocolBuilder()static java.lang.StringprintString(java.lang.Object ednValue)PrintednValueto a new String using the default printing protocol.static java.lang.StringprintString(Protocol<Printer.Fn<?>> fns, java.lang.Object ednValue)PrintednValueto a new String using the printing protocol given asfns.
-
-
-
Method Detail
-
newPrinter
public static Printer newPrinter(java.lang.Appendable out)
Return a new Printer with the default printing protocol. Everything the printer prints will be appended toout.Printer.close()will closeout, providedoutimplementsCloseable.- Parameters:
out- to which values will be printed. Never null.- Returns:
- a Printer with default configuration, never null.
-
printString
public static java.lang.String printString(java.lang.Object ednValue)
PrintednValueto a new String using the default printing protocol.- Parameters:
ednValue- the value to be returned as a String in edn syntax.- Returns:
- A string in edn syntax. Not null, not empty.
-
printString
public static java.lang.String printString(Protocol<Printer.Fn<?>> fns, java.lang.Object ednValue)
PrintednValueto a new String using the printing protocol given asfns.- Parameters:
fns- a Protocol which knows how to print all the classes of objects that we'll be asking our Printer to print. Never null. Never null.ednValue- the value to be returned as a String in edn syntax.- Returns:
- A string in edn syntax. Not null, not empty.
-
newPrinter
public static Printer newPrinter(Protocol<Printer.Fn<?>> fns, java.lang.Appendable out)
Return a new Printer with the printing protocol given asfns. Everything the printer prints will be appended towriter.Printer.close()will closeout, ifoutimplementsCloseable.- Parameters:
fns- a Protocol which knows how to print all the classes of objects that we'll be asking our Printer to print. Never null. Never null.out- to which values will be printed. Never null.- Returns:
- a Printer, never null.
-
defaultProtocolBuilder
public static Protocol.Builder<Printer.Fn<?>> defaultProtocolBuilder()
Returns aProtocol.Builderpreconfigured knowing how to print classes known to end-java:BigDecimalBigIntegerBooleanByte(as an integer)CharSequence(as a string literal)Character(as a character literal)Date(as#inst)DoubleFloatGregorianCalendar(as#inst)IntegerKeywordListLongMapSetShort(as an integer)SymbolTagTaggedValueTimestamp(as#inst)UUID(as#uuid)
-
defaultPrinterProtocol
public static Protocol<Printer.Fn<?>> defaultPrinterProtocol()
Return the default printerProtocol. This is equivalent todefaultProtocolBuilder().build().- Returns:
- the default printing
Protocol, never null.
-
prettyProtocolBuilder
public static Protocol.Builder<Printer.Fn<?>> prettyProtocolBuilder()
-
prettyPrinterProtocol
public static Protocol<Printer.Fn<?>> prettyPrinterProtocol()
-
-
DMelt 3.0 © DataMelt by jWork.ORG