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

public final class Template extends Object
A parsed template string.

A template string is a string that has zero or more TemplateVariables defined. For example "This is the key {{ key }}, and this is the partition {{ partition:padding=true }}". To construct a Template use the TemplateParser

  • Method Details

    • originalTemplate

      public String originalTemplate()
      Return the original template pattern.
      Returns:
      the template pattern.
    • variables

      public List<String> variables()
      Creates a new list of variable names.
      Returns:
      A new list of variable names.
    • variablesSet

      public Set<String> variablesSet()
      Creates a new set of variable names.
      Returns:
      A new set of variable names.
    • variablesWithParameters

      public List<VariableTemplatePart> variablesWithParameters()
      Gets a list of variable names to parameters. If duplicate variables appeared in the template there will be duplicates in the list.
      Returns:
      the list of variable names to parameters.
    • variablesWithNonEmptyParameters

      public List<VariableTemplatePart> variablesWithNonEmptyParameters()
      Gets a list of variable names to parameters where the parameters are known to be non empty. If duplicate variables appeared in the template there will be duplicates in the list.
      Returns:
      the list of variable names to parameters.
    • boundBuilder

      public Template.BoundBuilder boundBuilder()
      Creates a bound builder.
      Returns:
      a new BoundBuilder based on this template.
    • extractor

      public Template.Extractor extractor()
      Creates an extractor to parse variable values back from the rendered string.
      Returns:
      a new Extractor.
    • of

      @Deprecated public static Template of(String template)
      Creates a template from a template string.
      Parameters:
      template - the template string.
      Returns:
      the parsed template.
    • toString

      public String toString()
      Overrides:
      toString in class Object