Package org.approvej.json.jackson
Class JsonPrettyPrinter<T>
java.lang.Object
org.approvej.json.jackson.JsonPrettyPrinter<T>
- Type Parameters:
T
- the type of value to print
- All Implemented Interfaces:
Function<T,
,String> JsonPrinter<T>
,org.approvej.print.Printer<T>
A
Printer
that uses ObjectWriter.writeValueAsString(Object)
to print a value as
JSON.-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> JsonPrettyPrinter
<T> Creates aJsonPrettyPrinter
using the defaultJsonMapper
.static <T> JsonPrettyPrinter
<T> jsonPrettyPrinter
(com.fasterxml.jackson.databind.ObjectMapper objectMapper) Creates aJsonPrettyPrinter
using the givenObjectMapper
.static <T> JsonPrettyPrinter
<T> jsonPrettyPrinter
(com.fasterxml.jackson.databind.ObjectWriter objectWriter) Creates aJsonPrettyPrinter
using the givenObjectWriter
.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.approvej.json.jackson.JsonPrinter
filenameExtension
-
Method Details
-
jsonPrettyPrinter
public static <T> JsonPrettyPrinter<T> jsonPrettyPrinter(com.fasterxml.jackson.databind.ObjectWriter objectWriter) Creates aJsonPrettyPrinter
using the givenObjectWriter
.- Type Parameters:
T
- the type of value to print- Parameters:
objectWriter
- theObjectWriter
that will be used for printing- Returns:
- a new
JsonPrettyPrinter
instance
-
jsonPrettyPrinter
public static <T> JsonPrettyPrinter<T> jsonPrettyPrinter(com.fasterxml.jackson.databind.ObjectMapper objectMapper) Creates aJsonPrettyPrinter
using the givenObjectMapper
.- Type Parameters:
T
- the type of value to print- Parameters:
objectMapper
- theObjectMapper
used to create theObjectWriter
- Returns:
- a new
JsonPrettyPrinter
instance - See Also:
-
jsonPrettyPrinter
Creates aJsonPrettyPrinter
using the defaultJsonMapper
.- Type Parameters:
T
- the type of value to print- Returns:
- a new
JsonPrettyPrinter
instance - See Also:
-
apply
-