Interface ITypeResolver<T>
- Type Parameters:
T- the type of the object this type resolver is responsible for.
- All Known Implementing Classes:
AbstractToTextResolver
Deprecated, for removal: This API element is subject to removal in a future version.
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 org.docx4j.wml.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().addTypeResolver().
- Version:
- ${version}
- Author:
- Joseph Verron
-
Method Summary
Modifier and TypeMethodDescriptionorg.docx4j.wml.RDeprecated, for removal: This API element is subject to removal in a future version.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.
-
Method Details
-
resolve
org.docx4j.wml.R resolve(org.docx4j.openpackaging.packages.WordprocessingMLPackage document, T expressionResult) Deprecated, for removal: This API element is subject to removal in a future version.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. It creates an object of the DOCX4J api that is put in the place of the found expression.- Parameters:
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.- Returns:
- an object of the DOCX4J api (usually of type org.docx4j.wml.R = "run of text") that will be put in the place of an expression found in the .docx document.
-
ObjectResolver. The new resolver is more versatile, requires less reflection mechanism, and simplifies the internal workings of the docx-stamper project.