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 Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description T
finishMultipartTemplate()
Invoked at the conclusion of visiting a multipart template like `https://{Region}.{dnsSuffix}`.T
startMultipartTemplate()
Invoked prior to visiting a multipart template like `https://{Region}.{dnsSuffix}`.T
visitDynamicElement(Expr value)
Visit a dynamic element within a multipart template.T
visitSingleDynamicTemplate(Expr value)
The template contains a single dynamic element, eg.T
visitStaticElement(String value)
Visit a static element within a multipart template.T
visitStaticTemplate(String value)
The template contains a single static string, eg.
-
-
-
Method Detail
-
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(Expr 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 afterstartMultipartTemplate()
has been invoked.- Parameters:
value
- A static element within a larger template- Returns:
- T
-
visitDynamicElement
T visitDynamicElement(Expr value)
Visit a dynamic element within a multipart template. This will only be called afterstartMultipartTemplate()
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 ofvisitStaticTemplate(String)
andvisitDynamicElement(Expr)
.- 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
-
-