|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.reactive.beans.factory.config.DefaultPlaceholderMatcher
public class DefaultPlaceholderMatcher
The default implementation of PlaceholderMatcher
that uses the "standard" format of "${valueToBeEveluated}".
The default format can be overwritten by using the setPlaceholderRegex(String)
and setPlaceholderSuffix(String)
methods.
Field Summary | |
---|---|
static java.lang.String |
DEFAULT_PLACEHOLDER_PREFIX
|
static java.lang.String |
DEFAULT_PLACEHOLDER_REGEX
The default regex to determine if the value contains a placeholder. |
static java.lang.String |
DEFAULT_PLACEHOLDER_SUFFIX
|
protected java.util.regex.Matcher |
matcher
|
protected boolean |
multiplePlaceholdersPresent
If multple placeholders are present in the value then it must evaluate to a string |
protected java.util.regex.Pattern |
pattern
|
protected Placeholder |
placeholder
|
protected boolean |
placeholderPresent
|
protected java.lang.String |
placeholderRegex
The prefix for a placeholder value. |
protected java.lang.String |
proceedingText
|
protected int |
proceedingTextBeginIndex
|
protected java.lang.String |
trailingText
|
protected java.lang.String |
value
|
Constructor Summary | |
---|---|
DefaultPlaceholderMatcher()
|
Method Summary | |
---|---|
java.lang.String |
getPlaceholderPrefix()
|
java.lang.String |
getPlaceholderRegex()
Returns the prefix for a placeholder value. |
java.lang.String |
getPlaceholderSuffix()
|
java.lang.String |
getProceedingText()
Returns the proceeding text of the current Placeholder . |
java.lang.String |
getTrailingText()
Returns the trailing text of the current Placeholder . |
java.lang.String |
getValue()
|
boolean |
hasNext()
Moves to the next placeholder if one is available and returns true, otherwise this method returns false |
void |
init(java.lang.String value)
(Re-)Initialise the matcher for a new value. |
boolean |
isMultiplePlaceholdersPresent()
A method to determine if the provided value contains multiple placeholders. |
boolean |
isPlaceholderPresent()
A method to dermine if the provided key is a placeholder for a configurable value. |
Placeholder |
next()
Returns the next placeholder to be evaluated. |
void |
setPlaceholderPrefix(java.lang.String placeholderPrefix)
|
void |
setPlaceholderRegex(java.lang.String placeholderRegex)
Sets the prefix for a placeholder value. |
void |
setPlaceholderSuffix(java.lang.String placeholderSuffix)
|
protected java.lang.String |
stripPlaceholderWrappers(java.lang.String placeholderText)
This method returns the placeholder with the prefix and suffix removed. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String DEFAULT_PLACEHOLDER_REGEX
public static final java.lang.String DEFAULT_PLACEHOLDER_PREFIX
public static final java.lang.String DEFAULT_PLACEHOLDER_SUFFIX
protected java.lang.String placeholderRegex
protected java.lang.String value
protected java.util.regex.Pattern pattern
protected java.util.regex.Matcher matcher
protected boolean placeholderPresent
protected boolean multiplePlaceholdersPresent
protected Placeholder placeholder
protected int proceedingTextBeginIndex
protected java.lang.String proceedingText
protected java.lang.String trailingText
Constructor Detail |
---|
public DefaultPlaceholderMatcher()
Method Detail |
---|
public java.lang.String getPlaceholderRegex()
public void setPlaceholderRegex(java.lang.String placeholderRegex)
placeholderRegex
- the prefix for a placeholder valuepublic java.lang.String getPlaceholderPrefix()
public void setPlaceholderPrefix(java.lang.String placeholderPrefix)
public java.lang.String getPlaceholderSuffix()
public void setPlaceholderSuffix(java.lang.String placeholderSuffix)
public java.lang.String getValue()
public void init(java.lang.String value)
PlaceholderMatcher
init
in interface PlaceholderMatcher
value
- The value that we are now matchingpublic boolean isPlaceholderPresent()
PlaceholderMatcher
isPlaceholderPresent
in interface PlaceholderMatcher
public boolean isMultiplePlaceholdersPresent()
PlaceholderMatcher
isMultiplePlaceholdersPresent
in interface PlaceholderMatcher
public Placeholder next()
PlaceholderMatcher
Note: much like the iterator class, the PlaceholderMatcher.hasNext()
method must be called
before this method.
next
in interface PlaceholderMatcher
Placeholder
.public boolean hasNext()
PlaceholderMatcher
hasNext
in interface PlaceholderMatcher
protected java.lang.String stripPlaceholderWrappers(java.lang.String placeholderText)
e.g. a value of "${placeholder}" would return the value "placeholder".
placeholderText
- The placeholder text
public java.lang.String getProceedingText()
PlaceholderMatcher
Placeholder
.
e.g. a value of "some proceeding text ${placeholder}" would return "some proceeding next "
after the first call to PlaceholderMatcher.hasNext()
.
getProceedingText
in interface PlaceholderMatcher
public java.lang.String getTrailingText()
PlaceholderMatcher
Placeholder
.
e.g. a value of "some proceeding text ${placeholder} some trailing text" would return " some trailing text"
after the first call to PlaceholderMatcher.hasNext()
.
Note: the trailing text is also the proceeding text of the next placehodler where there are more placeholders.
getTrailingText
in interface PlaceholderMatcher
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |