org.codehaus.plexus.interpolation

## Class PrefixAwareRecursionInterceptor

- java.lang.Object
- - org.codehaus.plexus.interpolation.PrefixAwareRecursionInterceptor

All Implemented Interfaces:
  RecursionInterceptor

    public class PrefixAwareRecursionInterceptor
    extends Object
    implements RecursionInterceptor

`RecursionInterceptor` implementation that provides support for expressions with multiple synonyms, such as project.build.directory == pom.build.directory == build.directory in Maven's POM.

Version:
  $Id$
Author:
  jdcasey

### Field Summary

Fields
`static String` `DEFAULT_END_TOKEN`
`static String` `DEFAULT_START_TOKEN`

### Constructor Summary

Constructors
Constructor and Description
`PrefixAwareRecursionInterceptor(Collection<String> possiblePrefixes)` Use the specified expression prefixes to detect synonyms.
`PrefixAwareRecursionInterceptor(Collection<String> possiblePrefixes, boolean watchUnprefixedExpressions)` Use the specified expression prefixes to detect synonyms, and specify whether unprefixed expressions can be considered synonyms.

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `clear()` Reset the interceptor
`void` `expressionResolutionFinished(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(String expression)` Log the intention to start resolving the given expression.
`List` `getExpressionCycle(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(String expression)` Check whether the given value contains an expression that is currently being tracked by this interceptor.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### DEFAULT_START_TOKEN

    public static final String DEFAULT_START_TOKEN

See Also:
  Constant Field Values

#### DEFAULT_END_TOKEN

    public static final String DEFAULT_END_TOKEN

See Also:
  Constant Field Values

### Constructor Detail

#### PrefixAwareRecursionInterceptor

    public PrefixAwareRecursionInterceptor(Collection<String> possiblePrefixes,
                                           boolean watchUnprefixedExpressions)

Use the specified expression prefixes to detect synonyms, and specify whether unprefixed expressions can be considered synonyms.

Parameters:
  `possiblePrefixes` - The collection of expression prefixes supported
  `watchUnprefixedExpressions` - Whether to consider unprefixed expressions as synonyms

#### PrefixAwareRecursionInterceptor

    public PrefixAwareRecursionInterceptor(Collection<String> possiblePrefixes)

Use the specified expression prefixes to detect synonyms. Consider unprefixed expressions synonyms as well.

Parameters:
  `possiblePrefixes` - The collection of expression prefixes supported

### Method Detail

#### hasRecursiveExpression

    public boolean hasRecursiveExpression(String expression)

Description copied from interface: `RecursionInterceptor`
Check whether the given value contains an expression that is currently being tracked by this interceptor. If so, that expression is still in the process of being resolved, and this constitutes an expression cycle.

Specified by:
  `hasRecursiveExpression` in interface `RecursionInterceptor`
Parameters:
  `expression` - The value to check for expression cycles.
Returns:
  True if the value contains tracked expressions; false otherwise.

#### expressionResolutionFinished

    public void expressionResolutionFinished(String expression)

Description copied from interface: `RecursionInterceptor`
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 interface `RecursionInterceptor`
Parameters:
  `expression` - The expression to stop tracking.

#### expressionResolutionStarted

    public void expressionResolutionStarted(String expression)

Description copied from interface: `RecursionInterceptor`
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 interface `RecursionInterceptor`
Parameters:
  `expression` - The expression to be resolved.

#### getExpressionCycle

    public List getExpressionCycle(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, return `Collections.EMPTY_LIST`. Also, if the expression doesn't have a matched prefix from this interceptor's list, and unprefixed expressions aren't allowed then return `Collections.EMPTY_LIST`.

Specified by:
  `getExpressionCycle` in interface `RecursionInterceptor`
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 interface `RecursionInterceptor`