public interface ITypeResolver<S,T>
A type resolver is responsible for mapping an object of a certain Java class to an object of the DOCX4J api that can be put into the .docx document. Type resolvers are used to replace placeholders within the .docx template.
Example: if an expression returns a Date object as result, this date object is passed to a DateResolver which creates a R object (run of text) containing the properly formatted date string.
To use your own type resolver, implement this interface and register your implementation by calling DocxStamper.getTypeResolverRegistry().registerTypeResolver().
Modifier and Type | Method and Description |
---|---|
T |
resolve(org.docx4j.openpackaging.packages.WordprocessingMLPackage document,
S expressionResult)
This method is called when a placeholder in the .docx template is
to replaced by the result of an expression that
was found in the .docx template.
|
T resolve(org.docx4j.openpackaging.packages.WordprocessingMLPackage document, S expressionResult)
document
- the word document that can be accessed via the DOCX4J
api.
expressionResult
- the result of an expression. Only objects of
classes this type resolver is registered for
within the TypeResolverRegistrey are passed into this method.
Copyright © 2016. All rights reserved.