Class ToStringResolver

java.lang.Object
pro.verron.docxstamper.preset.resolver.ToStringResolver
All Implemented Interfaces:
ObjectResolver

public class ToStringResolver extends Object implements ObjectResolver
The ToStringResolver class is an implementation of the ObjectResolver interface that resolves objects by converting them to a string representation using the `toString()` method and creating a new run with the resolved content.
  • Constructor Details

    • ToStringResolver

      public ToStringResolver()
  • Method Details

    • canResolve

      public boolean canResolve(Object object)
      Description copied from interface: ObjectResolver
      Checks if the given object can be resolved.
      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 org.docx4j.wml.R resolve(org.docx4j.openpackaging.packages.WordprocessingMLPackage document, String placeholder, Object object)
      Description copied from interface: ObjectResolver
      Resolves the placeholder in the given document with the provided object.
      Specified by:
      resolve in interface ObjectResolver
      Parameters:
      document - the WordprocessingMLPackage document in which to resolve the placeholder
      placeholder - the placeholder value to be replaced
      object - the object to be used for resolving the placeholder
      Returns:
      the resolved value for the placeholder