Class StringTemplateParser
java.lang.Object
jodd.util.StringTemplateParser
Parser for string macro templates. On parsing, macro values
in provided string are resolved and replaced with real values.
Once set, one string template parser can be reused for parsing,
even using different macro resolvers.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionParses string template and replaces macros with resolved values.static StringTemplateParserstatic StringTemplateParserstatic StringTemplateParsersetEscapeChar(char escapeChar) Defines escape character.setMacroEnd(String macroEnd) Defines macro end string.setMacroPrefix(String macroPrefix) setMacroStart(String macroStart) Defines macro start string.setMissingKeyReplacement(String missingKeyReplacement) Specifies replacement for missing keys.setParseValues(boolean parseValues) Defines if macro values has to be parsed, too.setReplaceMissingKey(boolean replaceMissingKey) Specifies if missing keys should be resolved at all,trueby default.setResolveEscapes(boolean resolveEscapes) Specifies if escaped values should be resolved.Sets the strict format by setting the macro prefix tonull.
-
Field Details
-
DEFAULT_MACRO_PREFIX
- See Also:
-
DEFAULT_MACRO_START
- See Also:
-
DEFAULT_MACRO_END
- See Also:
-
macroResolver
-
replaceMissingKey
private boolean replaceMissingKey -
missingKeyReplacement
-
resolveEscapes
private boolean resolveEscapes -
macroPrefix
-
macroStart
-
macroEnd
-
escapeChar
private char escapeChar -
parseValues
private boolean parseValues
-
-
Constructor Details
-
StringTemplateParser
-
-
Method Details
-
of
-
ofMap
-
ofBean
-
setReplaceMissingKey
Specifies if missing keys should be resolved at all,trueby default. Iffalsemissing keys will be left as it were, i.e. they will not be replaced. -
setMissingKeyReplacement
Specifies replacement for missing keys. Ifnullexception will be thrown. -
setResolveEscapes
Specifies if escaped values should be resolved. In special usecases, when the same string has to be processed more then once, this may be set tofalseso escaped values remains. -
setMacroStart
Defines macro start string. -
setMacroPrefix
-
setMacroEnd
Defines macro end string. -
setStrictFormat
Sets the strict format by setting the macro prefix tonull. -
setEscapeChar
Defines escape character. -
setParseValues
Defines if macro values has to be parsed, too. By default, macro values are returned as they are. -
apply
-