Interface TemplateVisitor<T,C>
-
- Type Parameters:
T- operation return typeC- contextual parameter
- All Known Implementing Classes:
HasPropertyVisitor,SubstitutionVisitor
public interface TemplateVisitor<T,C>ATemplateVisitorrepresents an operation applied to aTemplate.All of the visit methods defaults to visitAny(Object) that throws an
UnsupportedOperationExceptionby default. It simplifies the visitor implementation if some common behaviour need to be implemented.
-
-
Method Summary
All Methods Instance Methods Default Methods Modifier and Type Method Description default TvisitAny(C context)Fallback method if the visitor does not implement the other visit methods.default TvisitEmpty(C context)Visit an empty template with the givencontextobject.default TvisitProperty(C context, Template property, Template defaultValue)Visit a property template with the givencontextobject.default TvisitSequence(C context, List<Template> sequence)Visit a sequence of templates with the givencontextobject.default TvisitText(C context, String text)Visit a textual template with the givencontextobject.
-
-
-
Method Detail
-
visitText
default T visitText(C context, String text)
Visit a textual template with the givencontextobject.- Parameters:
context- the contextual object (can benull)text- the text contained in the visited textual template- Returns:
- the result of the operation on the template
-
visitEmpty
default T visitEmpty(C context)
Visit an empty template with the givencontextobject.- Parameters:
context- the contextual object (can benull)- Returns:
- the result of the operation on the template
-
visitProperty
default T visitProperty(C context, Template property, Template defaultValue)
Visit a property template with the givencontextobject.- Parameters:
context- the contextual object (can benull)property- the template that defines the property's namedefaultValue- the template that defines the property's default value- Returns:
- the result of the operation on the template
-
visitSequence
default T visitSequence(C context, List<Template> sequence)
Visit a sequence of templates with the givencontextobject.- Parameters:
context- the contextual object (can benull)sequence- the (nevernull) list of templates within this sequence- Returns:
- the result of the operation on the template
-
-