Class VariableTemplatePart

java.lang.Object
io.aiven.commons.kafka.connector.common.templating.VariableTemplatePart
All Implemented Interfaces:
TemplatePart

public class VariableTemplatePart extends Object implements TemplatePart
A template part tht contains a variable definition.
  • Method Details

    • getVariableName

      public final String getVariableName()
      Returns the variable name.
      Returns:
      the variable name.
    • hasParameter

      public final boolean hasParameter()
      Determines if this variable template has a parameter associated.
      Returns:
      true if a parameter is available.
    • getParameter

      public final Parameter getParameter()
      Returns the associated parameter.
      Returns:
      the associated parameter. Will return Parameter.EMPTY if there is no parameter.
    • getOriginalPlaceholder

      public final String getOriginalPlaceholder()
      Returns the original placeholder for the template. This is the variable pattern with the enclosing curly braces.
      Returns:
      the original placeholder.
    • render

      public String render(Map<String,Function<Parameter,String>> bindings)
      Description copied from interface: TemplatePart
      Renders the template part using the bindings as necessary.
      Specified by:
      render in interface TemplatePart
      Parameters:
      bindings - the binding to map parameters with.
      Returns:
      the rendered string.
    • extract

      public String extract(Map<String,String> captureGroups)
      Description copied from interface: TemplatePart
      Extracts the original template string from the rendered text.
      Specified by:
      extract in interface TemplatePart
      Parameters:
      captureGroups - the capture group to use for extraction.
      Returns:
      the original string for this template.