Class AbstractToTextResolver<S>

  • Type Parameters:
    S - the type which to map into a run of text.
    All Implemented Interfaces:
    ITypeResolver<S,​org.docx4j.wml.R>
    Direct Known Subclasses:
    DateResolver, FallbackResolver

    public abstract class AbstractToTextResolver<S>
    extends Object
    implements ITypeResolver<S,​org.docx4j.wml.R>
    Abstract ITypeResolver that takes a String from the implementing sub class and creates a Run of text from it.
    • Constructor Detail

      • AbstractToTextResolver

        public AbstractToTextResolver()
    • Method Detail

      • resolveStringForObject

        protected abstract String resolveStringForObject​(S object)
      • resolve

        public org.docx4j.wml.R resolve​(org.docx4j.openpackaging.packages.WordprocessingMLPackage document,
                                        S expressionResult)
        Description copied from interface: ITypeResolver
        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.
        Specified by:
        resolve in interface ITypeResolver<S,​org.docx4j.wml.R>
        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.