Class SimpleRecursionInterceptor
- java.lang.Object
-
- org.codehaus.plexus.interpolation.SimpleRecursionInterceptor
-
- All Implemented Interfaces:
RecursionInterceptor
public class SimpleRecursionInterceptor extends java.lang.Object implements RecursionInterceptor
Simplest implementation of aRecursionInterceptor
, which checks whether the existing interpolation effort is already attempting to resolve an exact expression, but has not finished. This will not catch synonym expressions, as are found in Maven (${project.build.directory}, ${pom.build.directory}, and ${build.directory} are synonyms).
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.Stack
expressions
-
Constructor Summary
Constructors Constructor Description SimpleRecursionInterceptor()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clear()
Reset the interceptorvoid
expressionResolutionFinished(java.lang.String expression)
Signal to the interceptor that the all efforts to resolve the given expression have completed - whether successfully or not is irrelevant - and that the expression should not be tracked for recursion any longer.void
expressionResolutionStarted(java.lang.String expression)
Log the intention to start resolving the given expression.java.util.List
getExpressionCycle(java.lang.String expression)
When an expression is determined to be a recursive reference, this method returns the sublist of tracked expressions that participate in this cycle.boolean
hasRecursiveExpression(java.lang.String expression)
Check whether the current expression is already present in the in-process stack.
-
-
-
Method Detail
-
expressionResolutionFinished
public void expressionResolutionFinished(java.lang.String expression)
Signal to the interceptor that the all efforts to resolve the given expression have completed - whether successfully or not is irrelevant - and that the expression should not be tracked for recursion any longer.- Specified by:
expressionResolutionFinished
in interfaceRecursionInterceptor
- Parameters:
expression
- The expression to stop tracking.
-
expressionResolutionStarted
public void expressionResolutionStarted(java.lang.String expression)
Log the intention to start resolving the given expression. This signals the interceptor to start tracking that expression to make sure it doesn't come up again until after it has been resolved (or, fails to resolve).- Specified by:
expressionResolutionStarted
in interfaceRecursionInterceptor
- Parameters:
expression
- The expression to be resolved.
-
hasRecursiveExpression
public boolean hasRecursiveExpression(java.lang.String expression)
Check whether the current expression is already present in the in-process stack.- Specified by:
hasRecursiveExpression
in interfaceRecursionInterceptor
- Parameters:
expression
- The value to check for expression cycles.- Returns:
- True if the value contains tracked expressions; false otherwise.
-
getExpressionCycle
public java.util.List getExpressionCycle(java.lang.String expression)
When an expression is determined to be a recursive reference, this method returns the sublist of tracked expressions that participate in this cycle. Otherwise, if the expression isn't present in the in-process stack, returnCollections.EMPTY_LIST
.- Specified by:
getExpressionCycle
in interfaceRecursionInterceptor
- Parameters:
expression
- the expression to start with.- Returns:
- The list of expressions that participate in the cycle caused by the given expression.
-
clear
public void clear()
Description copied from interface:RecursionInterceptor
Reset the interceptor- Specified by:
clear
in interfaceRecursionInterceptor
-
-