Class TemplateParser
java.lang.Object
io.aiven.commons.kafka.connector.common.templating.TemplateParser
A parser for a template
-
Method Summary
Modifier and TypeMethodDescriptionstatic booleanisValidName(String name) Determines if a template or parameter name is valid.static Templateparse(String templatePattern, TemplateVariableRegistry registry) Parses the template.static voidvalidate(String configurationName, String templatePattern, TemplateVariableRegistry registry) Validates that the template string is parsable.
-
Method Details
-
validate
public static void validate(String configurationName, String templatePattern, TemplateVariableRegistry registry) Validates that the template string is parsable.- Parameters:
configurationName- the name of the template string. Generally the name of the configuration option that provided the template. pattern.templatePattern- the template string.registry- the registry of permitted TemplateVariables
-
parse
Parses the template.- Parameters:
templatePattern- the template string.registry- the template variable registry.- Returns:
- The parsed template object.
-
isValidName
Determines if a template or parameter name is valid. Valid names may not be empty and must consist of letters, digits,_,-, and.only.- Parameters:
name- the name to check- Returns:
trueif name comprises letters, digits,_,-, and.only.
-