Class StringResolver<T>

java.lang.Object
pro.verron.docxstamper.preset.resolver.StringResolver<T>
Type Parameters:
T - the type of the object to resolve
All Implemented Interfaces:
ObjectResolver
Direct Known Subclasses:
DateResolver, LocalDateResolver, LocalDateTimeResolver, LocalTimeResolver

public abstract class StringResolver<T> extends Object implements ObjectResolver
A StringResolver is an abstract class that provides a generic implementation for resolving objects to strings. It is used in conjunction with ObjectResolver interface to provide a flexible way to resolve different types of objects to strings.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    Creates a new StringResolver with the given type.
  • Method Summary

    Modifier and Type
    Method
    Description
    final boolean
    Determines if the given object can be resolved by the StringResolver.
    final org.docx4j.wml.R
    resolve(org.docx4j.openpackaging.packages.WordprocessingMLPackage document, String placeholder, Object object)
    Resolves an object to a string and creates a new run with the resolved string as content.
    protected abstract String
    resolve(T object)
    Resolves an object to a string.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • StringResolver

      protected StringResolver(Class<T> type)
      Creates a new StringResolver with the given type.
      Parameters:
      type - the type of object to be resolved
  • Method Details

    • canResolve

      public final boolean canResolve(Object object)
      Determines if the given object can be resolved by the StringResolver.
      Specified by:
      canResolve in interface ObjectResolver
      Parameters:
      object - the object to be resolved
      Returns:
      true if the object can be resolved, false otherwise
    • resolve

      public final org.docx4j.wml.R resolve(org.docx4j.openpackaging.packages.WordprocessingMLPackage document, String placeholder, Object object)
      Resolves an object to a string and creates a new run with the resolved string as content.
      Specified by:
      resolve in interface ObjectResolver
      Parameters:
      document - the WordprocessingMLPackage document
      placeholder - the placeholder string
      object - the object to be resolved
      Returns:
      the newly created run with the resolved string as content
    • resolve

      protected abstract String resolve(T object)
      Resolves an object to a string.
      Parameters:
      object - the object to be resolved
      Returns:
      the string representation of the object