Package org.approvej.json.jackson
Class JsonPrintFormat<T>
java.lang.Object
org.approvej.json.jackson.JsonPrintFormat<T>
- Type Parameters:
T- the type of the object to print
- All Implemented Interfaces:
org.approvej.print.PrintFormat<T>
@NullMarked
public final class JsonPrintFormat<T>
extends Object
implements org.approvej.print.PrintFormat<T>
A
PrintFormat that uses ObjectWriter.writeValueAsString(Object) to print a value
as JSON.-
Field Summary
Fields inherited from interface org.approvej.print.PrintFormat
DEFAULT_FILENAME_EXTENSION -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> JsonPrintFormat<T> json()Creates aJsonPrintFormatusing the defaultJsonMapper.static <T> JsonPrintFormat<T> json(com.fasterxml.jackson.databind.ObjectMapper objectMapper) Creates aJsonPrintFormatusing the givenObjectMapper.org.approvej.print.Printer<T> printer()
-
Constructor Details
-
JsonPrintFormat
public JsonPrintFormat()Default constructor to be used inConfiguration.
-
-
Method Details
-
printer
- Specified by:
printerin interfaceorg.approvej.print.PrintFormat<T>
-
filenameExtension
- Specified by:
filenameExtensionin interfaceorg.approvej.print.PrintFormat<T>
-
json
Creates aJsonPrintFormatusing the givenObjectMapper.- Type Parameters:
T- the type of value to print- Parameters:
objectMapper- theObjectMapperused to create theObjectWriter- Returns:
- a new
JsonPrintFormatinstance - See Also:
-
json
Creates aJsonPrintFormatusing the defaultJsonMapper.- Type Parameters:
T- the type of value to print- Returns:
- a new
JsonPrintFormatinstance - See Also:
-