public class MultiDelimiterStringSearchInterpolator extends java.lang.Object implements Interpolator
Modifier and Type | Field and Description |
---|---|
private boolean |
cacheAnswers |
private java.util.LinkedHashSet<DelimiterSpecification> |
delimiters |
private java.lang.String |
escapeString |
private java.util.Map |
existingAnswers |
private static int |
MAX_TRIES |
private java.util.List |
postProcessors |
private java.util.List<ValueSource> |
valueSources |
Constructor and Description |
---|
MultiDelimiterStringSearchInterpolator() |
Modifier and Type | Method and Description |
---|---|
MultiDelimiterStringSearchInterpolator |
addDelimiterSpec(java.lang.String delimiterSpec) |
void |
addPostProcessor(InterpolationPostProcessor postProcessor)
Add a new post-processor to handle final processing after
recursively-interpolated value is determined.
|
void |
addValueSource(ValueSource valueSource)
Add a new
ValueSource to the stack used to resolve expressions
in this interpolator instance. |
void |
clearAnswers() |
void |
clearFeedback()
Clear the feedback messages from previous interpolate(..) calls.
|
MultiDelimiterStringSearchInterpolator |
escapeString(java.lang.String escapeString) |
java.lang.String |
getEscapeString() |
java.util.List |
getFeedback()
Return any feedback messages and errors that were generated - but suppressed - during the interpolation process.
|
java.lang.String |
interpolate(java.lang.String input)
|
java.lang.String |
interpolate(java.lang.String input,
RecursionInterceptor recursionInterceptor)
Entry point for recursive resolution of an expression and all of its nested expressions.
|
private java.lang.String |
interpolate(java.lang.String input,
RecursionInterceptor recursionInterceptor,
java.util.Set<java.lang.String> unresolvable) |
java.lang.String |
interpolate(java.lang.String input,
java.lang.String thisPrefixPattern)
|
java.lang.String |
interpolate(java.lang.String input,
java.lang.String thisPrefixPattern,
RecursionInterceptor recursionInterceptor)
Attempt to resolve all expressions in the given input string, using the
given pattern to first trim an optional prefix from each expression.
|
boolean |
isCacheAnswers() |
boolean |
removeDelimiterSpec(java.lang.String delimiterSpec) |
void |
removePostProcessor(InterpolationPostProcessor postProcessor)
Remove the given post-processor.
|
void |
removeValuesSource(ValueSource valueSource)
Remove the specified
ValueSource from the stack used to resolve
expressions in this interpolator instance. |
private DelimiterSpecification |
select(java.lang.String input,
int lastEndIdx) |
void |
setCacheAnswers(boolean cacheAnswers) |
MultiDelimiterStringSearchInterpolator |
setDelimiterSpecs(java.util.LinkedHashSet<java.lang.String> specs) |
void |
setEscapeString(java.lang.String escapeString) |
MultiDelimiterStringSearchInterpolator |
withPostProcessor(InterpolationPostProcessor postProcessor) |
MultiDelimiterStringSearchInterpolator |
withValueSource(ValueSource vs) |
private static final int MAX_TRIES
private java.util.Map existingAnswers
private java.util.List<ValueSource> valueSources
private java.util.List postProcessors
private boolean cacheAnswers
private java.util.LinkedHashSet<DelimiterSpecification> delimiters
private java.lang.String escapeString
public MultiDelimiterStringSearchInterpolator()
public MultiDelimiterStringSearchInterpolator addDelimiterSpec(java.lang.String delimiterSpec)
public boolean removeDelimiterSpec(java.lang.String delimiterSpec)
public MultiDelimiterStringSearchInterpolator withValueSource(ValueSource vs)
public MultiDelimiterStringSearchInterpolator withPostProcessor(InterpolationPostProcessor postProcessor)
public void addValueSource(ValueSource valueSource)
ValueSource
to the stack used to resolve expressions
in this interpolator instance.addValueSource
in interface Interpolator
valueSource
- ValueSource
.public void removeValuesSource(ValueSource valueSource)
ValueSource
from the stack used to resolve
expressions in this interpolator instance.removeValuesSource
in interface Interpolator
valueSource
- ValueSource
.public void addPostProcessor(InterpolationPostProcessor postProcessor)
addPostProcessor
in interface Interpolator
postProcessor
- InterpolationPostProcessor
.public void removePostProcessor(InterpolationPostProcessor postProcessor)
removePostProcessor
in interface Interpolator
postProcessor
- InterpolationPostProcessor
.public java.lang.String interpolate(java.lang.String input, java.lang.String thisPrefixPattern) throws InterpolationException
Interpolator
Interpolator.interpolate(String, String, RecursionInterceptor)
.
This method triggers the use of a SimpleRecursionInterceptor
instance for protection against expression cycles.
interpolate
in interface Interpolator
input
- The input string to interpolatethisPrefixPattern
- An optional pattern that should be trimmed from
the start of any expressions found in the input.InterpolationException
- in case of an error.public java.lang.String interpolate(java.lang.String input, java.lang.String thisPrefixPattern, RecursionInterceptor recursionInterceptor) throws InterpolationException
Interpolator
interpolate
in interface Interpolator
input
- The input string to interpolatethisPrefixPattern
- An optional pattern that should be trimmed from
the start of any expressions found in the input.recursionInterceptor
- Used to protect the interpolation process
from expression cycles, and throw an
exception if one is detected.InterpolationException
- in case of an error.public java.lang.String interpolate(java.lang.String input) throws InterpolationException
BasicInterpolator
Interpolator.interpolate(String, String, org.codehaus.plexus.interpolation.RecursionInterceptor)
.
This method triggers the use of a SimpleRecursionInterceptor
instance for protection against expression cycles. It also leaves empty the
expression prefix which would otherwise be trimmed from expressions. The
result is that any detected expression will be resolved as-is.
interpolate
in interface BasicInterpolator
input
- The input string to interpolateInterpolationException
- in case of an error.public java.lang.String interpolate(java.lang.String input, RecursionInterceptor recursionInterceptor) throws InterpolationException
interpolate
in interface BasicInterpolator
input
- The input string to interpolaterecursionInterceptor
- Used to protect the interpolation process
from expression cycles, and throw an
exception if one is detected.InterpolationException
- in case of an error.private java.lang.String interpolate(java.lang.String input, RecursionInterceptor recursionInterceptor, java.util.Set<java.lang.String> unresolvable) throws InterpolationException
InterpolationException
private DelimiterSpecification select(java.lang.String input, int lastEndIdx)
public java.util.List getFeedback()
getFeedback
in interface Interpolator
List
that may be interspersed with String
and Throwable
instances.public void clearFeedback()
clearFeedback
in interface Interpolator
public boolean isCacheAnswers()
isCacheAnswers
in interface Interpolator
public void setCacheAnswers(boolean cacheAnswers)
setCacheAnswers
in interface Interpolator
cacheAnswers
- true/false.public void clearAnswers()
clearAnswers
in interface Interpolator
public java.lang.String getEscapeString()
public void setEscapeString(java.lang.String escapeString)
public MultiDelimiterStringSearchInterpolator escapeString(java.lang.String escapeString)
public MultiDelimiterStringSearchInterpolator setDelimiterSpecs(java.util.LinkedHashSet<java.lang.String> specs)