Class StringSearchInterpolator
java.lang.Object
org.codehaus.plexus.interpolation.StringSearchInterpolator
- All Implemented Interfaces:
BasicInterpolator,Interpolator
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddPostProcessor(InterpolationPostProcessor postProcessor) Add a new post-processor to handle final processing after recursively-interpolated value is determined.voidaddValueSource(ValueSource valueSource) Add a newValueSourceto the stack used to resolve expressions in this interpolator instance.voidvoidClear the feedback messages from previous interpolate(..) calls.protected ObjectgetExistingAnswer(String key) For testing purposes only.Return any feedback messages and errors that were generated - but suppressed - during the interpolation process.interpolate(String input) interpolate(String input, String thisPrefixPattern) interpolate(String input, 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.interpolate(String input, RecursionInterceptor recursionInterceptor) Entry point for recursive resolution of an expression and all of its nested expressions.booleanvoidremovePostProcessor(InterpolationPostProcessor postProcessor) Remove the given post-processor.voidremoveValuesSource(ValueSource valueSource) Remove the specifiedValueSourcefrom the stack used to resolve expressions in this interpolator instance.voidsetCacheAnswers(boolean cacheAnswers) voidsetEscapeString(String escapeString)
-
Field Details
-
DEFAULT_START_EXPR
- See Also:
-
DEFAULT_END_EXPR
- See Also:
-
-
Constructor Details
-
StringSearchInterpolator
public StringSearchInterpolator() -
StringSearchInterpolator
-
-
Method Details
-
addValueSource
Add a newValueSourceto the stack used to resolve expressions in this interpolator instance.- Specified by:
addValueSourcein interfaceInterpolator- Parameters:
valueSource-ValueSource.
-
removeValuesSource
Remove the specifiedValueSourcefrom the stack used to resolve expressions in this interpolator instance.- Specified by:
removeValuesSourcein interfaceInterpolator- Parameters:
valueSource-ValueSource.
-
addPostProcessor
Add a new post-processor to handle final processing after recursively-interpolated value is determined.- Specified by:
addPostProcessorin interfaceInterpolator- Parameters:
postProcessor-InterpolationPostProcessor.
-
removePostProcessor
Remove the given post-processor.- Specified by:
removePostProcessorin interfaceInterpolator- Parameters:
postProcessor-InterpolationPostProcessor.
-
interpolate
Description copied from interface:InterpolatorSeeInterpolator.interpolate(String, String, RecursionInterceptor).This method triggers the use of a
SimpleRecursionInterceptorinstance for protection against expression cycles.- Specified by:
interpolatein interfaceInterpolator- Parameters:
input- The input string to interpolatethisPrefixPattern- An optional pattern that should be trimmed from the start of any expressions found in the input.- Returns:
- interpolated string.
- Throws:
InterpolationException- in case of an error.
-
interpolate
public String interpolate(String input, String thisPrefixPattern, RecursionInterceptor recursionInterceptor) throws InterpolationException Description copied from interface:InterpolatorAttempt to resolve all expressions in the given input string, using the given pattern to first trim an optional prefix from each expression. The supplied recursion interceptor will provide protection from expression cycles, ensuring that the input can be resolved or an exception is thrown. return an empty String if input is null- Specified by:
interpolatein interfaceInterpolator- Parameters:
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.- Returns:
- interpolated string.
- Throws:
InterpolationException- in case of an error.
-
interpolate
Description copied from interface:BasicInterpolatorSeeInterpolator.interpolate(String, String, org.codehaus.plexus.interpolation.RecursionInterceptor).This method triggers the use of a
SimpleRecursionInterceptorinstance 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.- Specified by:
interpolatein interfaceBasicInterpolator- Parameters:
input- The input string to interpolate- Returns:
- the interpolated string.
- Throws:
InterpolationException- in case of an error.
-
interpolate
public String interpolate(String input, RecursionInterceptor recursionInterceptor) throws InterpolationException Entry point for recursive resolution of an expression and all of its nested expressions. TODO: Ensure unresolvable expressions don't trigger infinite recursion.- Specified by:
interpolatein interfaceBasicInterpolator- Parameters:
input- The input string to interpolaterecursionInterceptor- Used to protect the interpolation process from expression cycles, and throw an exception if one is detected.- Returns:
- the interpolated string.
- Throws:
InterpolationException- in case of an error.
-
getFeedback
Return any feedback messages and errors that were generated - but suppressed - during the interpolation process. Since unresolvable expressions will be left in the source string as-is, this feedback is optional, and will only be useful for debugging interpolation problems.- Specified by:
getFeedbackin interfaceInterpolator- Returns:
- a
Listthat may be interspersed withStringandThrowableinstances.
-
clearFeedback
public void clearFeedback()Clear the feedback messages from previous interpolate(..) calls.- Specified by:
clearFeedbackin interfaceInterpolator
-
isCacheAnswers
public boolean isCacheAnswers()- Specified by:
isCacheAnswersin interfaceInterpolator- Returns:
- state of the cacheAnswers
-
setCacheAnswers
public void setCacheAnswers(boolean cacheAnswers) - Specified by:
setCacheAnswersin interfaceInterpolator- Parameters:
cacheAnswers- true/false.
-
clearAnswers
public void clearAnswers()- Specified by:
clearAnswersin interfaceInterpolator
-
getEscapeString
-
setEscapeString
-
getExistingAnswer
-