Package org.mycore.common
Class MCRTextResolver.Term
java.lang.Object
org.mycore.common.MCRTextResolver.Term
- Direct Known Subclasses:
MCRTextResolver.Condition
,MCRTextResolver.EscapeCharacter
,MCRTextResolver.Text
,MCRTextResolver.Variable
- Enclosing class:
- MCRTextResolver
A term is a defined part in a text. In general, a term is defined by brackets,
but this is not required. Here are some example terms:
- Variable: {term1}
- Condition: [term2]
- EscapeChar: \[
MCRTextResolverTest
class.- Author:
- Matthias Eichner
-
Field Summary
Modifier and TypeFieldDescriptionprotected int
The current character position in the term.protected boolean
If the term is successfully resolved.protected StringBuffer
The string buffer within the term.protected MCRTextResolver
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionabstract String
Implement this to define the end enclosing string for your term.abstract String
Implement this to define the start enclosing string for your term.getValue()
Returns the value of the term.Resolves the text from the startPosition to the end of the text or if a term specific end character is found.protected abstract boolean
resolveInternal
(String text, int pos) Does term specific resolving for the current character.
-
Field Details
-
termBuffer
The string buffer within the term. For example: {var}. -
resolved
protected boolean resolvedIf the term is successfully resolved. By default this is true. -
position
protected int positionThe current character position in the term. -
textResolver
-
-
Constructor Details
-
Term
-
-
Method Details
-
resolve
Resolves the text from the startPosition to the end of the text or if a term specific end character is found.- Parameters:
text
- the term to resolvestartPosition
- the current character position- Returns:
- the value of the term after resolving
-
resolveInternal
Does term specific resolving for the current character.- Returns:
- true if the end string is reached, otherwise false
-
getValue
Returns the value of the term. Overwrite this if you don't want to get the default termBuffer content as value.- Returns:
- the value of the term
-
getStartEnclosingString
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.- Returns:
- the start enclosing string
-
getEndEnclosingString
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.- Returns:
- the end enclosing string
-
getTextResolver
-