java.lang.Object
io.aiven.commons.kafka.connector.common.templating.TemplateParser

public final class TemplateParser extends Object
A parser for a template
  • Method Details

    • validate

      public static void validate(String configurationName, String templatePattern, TemplateVariableRegistry registry)
      Validates that the template string is parsable.
      Parameters:
      configurationName - the name of the template string. Generally the name of the configuration option that provided the template. pattern.
      templatePattern - the template string.
      registry - the registry of permitted TemplateVariables
    • checkMalformed

      public static List<String> checkMalformed(String name, String text, TemplateVariableRegistry registry)
      Checks if a text string may contain malformed templates. If a valid template is passed it will be returned as potentially malformed.
      Parameters:
      name - the name of the template configuration option.
      text - the text that may be an invalid template, should not be a valid template.
      registry - The TemplateVariableRegistry to validate against. May be null.
      Returns:
      A list of log messages indicating the malformed templates.
    • parse

      public static Template parse(String templatePattern, TemplateVariableRegistry registry)
      Parses the template.
      Parameters:
      templatePattern - the template string.
      registry - the template variable registry.
      Returns:
      The parsed template object.