Package org.mycore.common
Class MCRTextResolver.Variable
java.lang.Object
org.mycore.common.MCRTextResolver.Term
org.mycore.common.MCRTextResolver.Variable
- Direct Known Subclasses:
MCRPropertiesResolver.Property
- Enclosing class:
- MCRTextResolver
A variable is surrounded by curly brackets. It supports recursive
resolving for the content of the variable. The name of the variable
is set by the termBuffer and the value is equal the content of the
valueBuffer.
-
Field Summary
Fields inherited from class org.mycore.common.MCRTextResolver.Term
position, resolved, termBuffer, textResolver
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionImplement this to define the end enclosing string for your term.Implement this to define the start enclosing string for your term.protected String
getValue()
Returns the value of the term.boolean
resolveInternal
(String text, int pos) Does term specific resolving for the current character.resolveText
(String text) This method resolves all variables in the text.protected void
track()
Tracks the variable to check for circular dependency.protected void
untrack()
Methods inherited from class org.mycore.common.MCRTextResolver.Term
getTextResolver, resolve
-
Constructor Details
-
Variable
-
-
Method Details
-
resolveInternal
Description copied from class:MCRTextResolver.Term
Does term specific resolving for the current character.- Specified by:
resolveInternal
in classMCRTextResolver.Term
- Returns:
- true if the end string is reached, otherwise false
-
getValue
Description copied from class:MCRTextResolver.Term
Returns the value of the term. Overwrite this if you don't want to get the default termBuffer content as value.- Overrides:
getValue
in classMCRTextResolver.Term
- Returns:
- the value of the term
-
getStartEnclosingString
Description copied from class:MCRTextResolver.Term
Implement this to define the start enclosing string for your term. The resolver searches in the text for this string, if found, the text is processed by your term.- Specified by:
getStartEnclosingString
in classMCRTextResolver.Term
- Returns:
- the start enclosing string
-
getEndEnclosingString
Description copied from class:MCRTextResolver.Term
Implement this to define the end enclosing string for your term. You have to check manual in theresolveInternal
method if the end of your term is reached.- Specified by:
getEndEnclosingString
in classMCRTextResolver.Term
- Returns:
- the end enclosing string
-
track
protected void track()Tracks the variable to check for circular dependency. -
untrack
protected void untrack() -
getTrackID
-
resolveText
This method resolves all variables in the text. The syntax is described at the head of the class.- Parameters:
text
- the string where the variables have to be resolved- Returns:
- the resolved string
-