Interface TemplateVisitor<T>

Type Parameters:
T - The return type of this visitor

public interface TemplateVisitor<T>
For code generating from a template, use a `TemplateVisitor`. Template visitor is written to enable optimized behavior for static templates with no dynamic components.
  • Method Details

    • visitStaticTemplate

      T visitStaticTemplate(String value)
      The template contains a single static string, eg. "https://mystaticendpoing.com"
      Parameters:
      value - The static value of the template.
      Returns:
      T
    • visitSingleDynamicTemplate

      T visitSingleDynamicTemplate(Expression value)
      The template contains a single dynamic element, eg. `{Region}`. In this case, string formatting is not required. The type of the value is guaranteed to be a string.
      Parameters:
      value - The single expression that represents this template.
      Returns:
      T
    • visitStaticElement

      T visitStaticElement(String value)
      Visit a static element within a multipart template. This will only be called after startMultipartTemplate() has been invoked.
      Parameters:
      value - A static element within a larger template
      Returns:
      T
    • visitDynamicElement

      T visitDynamicElement(Expression value)
      Visit a dynamic element within a multipart template. This will only be called after startMultipartTemplate() has been invoked.
      Parameters:
      value - The dynamic template value
      Returns:
      T
    • startMultipartTemplate

      T startMultipartTemplate()
      Invoked prior to visiting a multipart template like `https://{Region}.{dnsSuffix}`. This function will be followed by invocations of visitStaticTemplate(String) and visitDynamicElement(Expression).
      Returns:
      T
    • finishMultipartTemplate

      T finishMultipartTemplate()
      Invoked at the conclusion of visiting a multipart template like `https://{Region}.{dnsSuffix}`. This allows implementations to do something like call `string.join()` or `stringbuilder.toString()`.
      Returns:
      T