Class TemplateHelper

java.lang.Object
io.helidon.inject.tools.TemplateHelper

public class TemplateHelper extends Object
Helper tools for dealing with Injection-related Handlebar templates.
  • Field Details

    • TAG_TEMPLATE_NAME

      public static final String TAG_TEMPLATE_NAME
      The tag that us used to represent the template name to use.
      See Also:
    • DEFAULT_TEMPLATE_NAME

      public static final String DEFAULT_TEMPLATE_NAME
      The default template name to use.
      See Also:
  • Method Details

    • create

      public static TemplateHelper create()
      Creates a template helper utility using the global bootstrap configuration.
      Returns:
      the template helper initialized with the bootstrap configuration
    • generatedStickerFor

      public String generatedStickerFor(TypeName generatorClassTypeName, TypeName triggerClassType, TypeName generatedType)
      Produces the generated sticker annotation attribute contents.
      Parameters:
      generatorClassTypeName - the generator class type name
      triggerClassType - class that caused the type to be generated
      generatedType - generated type
      Returns:
      the generated sticker
    • applySubstitutions

      public String applySubstitutions(CharSequence target, Map<String,Object> props, boolean logErr)
      Apply substitutions.
      Parameters:
      target - the target string to find substitutions for
      props - the replacements
      logErr - flag indicating whether logger should be written for errors and warnings
      Returns:
      the new string, fully resolved with substitutions
    • requiredArguments

      public Set<String> requiredArguments(String target)
      Determine the arguments needed for template evaluation.
      Parameters:
      target - the target template
      Returns:
      the set of attributes that are required for substitution
    • loadTemplate

      public String loadTemplate(String templateName, String name)
      Same as safeLoadTemplate(String, String) but will return null if the template name is not found.
      Parameters:
      templateName - the template profile/directory
      name - the template name to use
      Returns:
      the template, or null if not found