Class PdfInvoiceTemplate
java.lang.Object
org.nekosoft.pdffer.template.AbstractJacksonPdfTemplate<InvoiceData>
org.nekosoft.PDFferTemplates.invoice.PdfInvoiceTemplate
- All Implemented Interfaces:
 PdfTemplate<InvoiceData>
A template for PDFfer that takes an 
InvoiceData instance as payload and
 generates a PDF invoice document from it.- 
Field Summary
Fields inherited from class org.nekosoft.pdffer.template.AbstractJacksonPdfTemplate
pdfContent - 
Constructor Summary
Constructors - 
Method Summary
Modifier and TypeMethodDescriptionvoidgenerate()Prepares the PDF document.Returns the payload class that this template is able to handle.protected InvoiceDatainitPayload(InvoiceData data)Override this method to initialize the template and its parts once a payload has been set.Methods inherited from class org.nekosoft.pdffer.template.AbstractJacksonPdfTemplate
getJsonMapper, getPayload, getPdfContent, setPayload, setPayloadJson, setPayloadMap, toString, validate, validatePayload 
- 
Constructor Details
- 
PdfInvoiceTemplate
public PdfInvoiceTemplate()Instantiates a new Pdf invoice template. 
 - 
 - 
Method Details
- 
getPayloadClass
Description copied from interface:PdfTemplateReturns 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
 
 - 
initPayload
Description copied from class:AbstractJacksonPdfTemplateOverride this method to initialize the template and its parts once a payload has been set. For example, you could configure the
JSON mapperor any formatters your template might use based on information in the payload. The method also allows you to completely change the payload if you need to and return a different one to be set into the template.This method is called by
AbstractJacksonPdfTemplate.setPayload(Object), so there is no need to ever overridesetPayloaditself.The default implementation does nothing and then returns the same value it receives.
- Overrides:
 initPayloadin classAbstractJacksonPdfTemplate<InvoiceData>- Parameters:
 data- the payload that is being set into the template- Returns:
 - the payload to be set into the template (in most cases you will simply return the same value you receive)
 
 - 
generate
public void generate()Description copied from interface:PdfTemplatePrepares 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. 
 -