Package org.nekosoft.PDFferTemplates
Class DefaultPdfTemplate
java.lang.Object
org.nekosoft.pdffer.template.AbstractJacksonPdfTemplate<Map<String,Object>>
org.nekosoft.PDFferTemplates.DefaultPdfTemplate
- All Implemented Interfaces:
PdfTemplate<Map<String,Object>>
A very basic template for PDFfer that takes a java Map of String to Object
and prints it out in table form with the key name and corresponding value
in each row.
-
Field Summary
Fields inherited from class org.nekosoft.pdffer.template.AbstractJacksonPdfTemplate
pdfContent
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
generate()
Prepares the PDF document.Returns the payload class that this template is able to handle.void
setPayloadMap(Map<String,Object> map)
Takes a Java map and creates the payload for the template from it.Methods inherited from class org.nekosoft.pdffer.template.AbstractJacksonPdfTemplate
getJsonMapper, getPayload, getPdfContent, initPayload, setPayload, setPayloadJson, toString, validate, validatePayload
-
Constructor Details
-
DefaultPdfTemplate
public DefaultPdfTemplate()
-
-
Method Details
-
getPayloadClass
Description copied from interface:PdfTemplate
Returns the payload class that this template is able to handle. It takes instances of the class returned by this method and produces PDFs from them.- Returns:
- the payload class
-
setPayloadMap
Description copied from class:AbstractJacksonPdfTemplate
Takes a Java map and creates the payload for the template from it. The map must contain all the attributes required by the payload class (as specified by the
PdfTemplate.getPayloadClass()
method), and a JacksonObjectMapper
will be used for the conversion.This will trigger a call to
.AbstractJacksonPdfTemplate.initPayload(Object)
- Overrides:
setPayloadMap
in classAbstractJacksonPdfTemplate<Map<String,Object>>
- Parameters:
map
- the Java map representation of the payload
-
generate
public void generate()Description copied from interface:PdfTemplate
Prepares the PDF document. It uses the payload set withPdfTemplate.setPayload(Object)
and assumes that the payload has already been checked withPdfTemplate.validate()
. The generated PDF document can be accessed withPdfTemplate.getPdfContent()
after this method returns.
-