Package org.forgerock.config.resolvers
Class SubstitutionVisitor
- java.lang.Object
-
- org.forgerock.config.resolvers.SubstitutionVisitor
-
- All Implemented Interfaces:
TemplateVisitor<String,SubstitutionContext>
public final class SubstitutionVisitor extends Object implements TemplateVisitor<String,SubstitutionContext>
This visitor evaluatesTemplate
s with the help of aPropertyResolver
.It supports recursive evaluation if given a
TemplateParser
.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SubstitutionVisitor.Builder
Builder ofSubstitutionVisitor
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static SubstitutionVisitor.Builder
substitution(PropertyResolver resolver)
Create a builder forSubstitutionVisitor
.String
visitEmpty(SubstitutionContext context)
Visit an empty template with the givencontext
object.String
visitProperty(SubstitutionContext context, Template property, Template defaultValue)
Visit a property template with the givencontext
object.String
visitSequence(SubstitutionContext context, List<Template> sequence)
Visit a sequence of templates with the givencontext
object.String
visitText(SubstitutionContext context, String text)
Visit a textual template with the givencontext
object.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.forgerock.config.resolvers.template.TemplateVisitor
visitAny
-
-
-
-
Method Detail
-
substitution
public static SubstitutionVisitor.Builder substitution(PropertyResolver resolver)
Create a builder forSubstitutionVisitor
.- Parameters:
resolver
- property resolver used to evaluate properties- Returns:
- a new builder
-
visitText
public String visitText(SubstitutionContext context, String text)
Description copied from interface:TemplateVisitor
Visit a textual template with the givencontext
object.- Specified by:
visitText
in interfaceTemplateVisitor<String,SubstitutionContext>
- 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
public String visitEmpty(SubstitutionContext context)
Description copied from interface:TemplateVisitor
Visit an empty template with the givencontext
object.- Specified by:
visitEmpty
in interfaceTemplateVisitor<String,SubstitutionContext>
- Parameters:
context
- the contextual object (can benull
)- Returns:
- the result of the operation on the template
-
visitProperty
public String visitProperty(SubstitutionContext context, Template property, Template defaultValue)
Description copied from interface:TemplateVisitor
Visit a property template with the givencontext
object.- Specified by:
visitProperty
in interfaceTemplateVisitor<String,SubstitutionContext>
- 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
public String visitSequence(SubstitutionContext context, List<Template> sequence)
Description copied from interface:TemplateVisitor
Visit a sequence of templates with the givencontext
object.- Specified by:
visitSequence
in interfaceTemplateVisitor<String,SubstitutionContext>
- 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
-
-