org.codehaus.plexus.interpolation

Class AbstractFunctionValueSourceWrapper

public abstract class AbstractFunctionValueSourceWrapper extends Object implements ValueSource

ValueSource abstract implementation that wraps another value source. When an expression is resolved, this wrapped source is first used to retrieve the expression's actual value; then, the last expression processed by this source is retrieved, and the two are passed into the abstract method AbstractFunctionValueSourceWrapper together. The result of this is returned as the resolved value for the second expression.
This allows the first expression to be a function name that modifies the value of the second expression, which is resolved from the wrapped value source.

Version: $Id: AbstractFunctionValueSourceWrapper.java 7529 2008-07-20 20:24:21Z olamy $

Constructor Summary
protected AbstractFunctionValueSourceWrapper(ValueSource valueSource)
Construct a new function value source instance, using the supplied ValueSource to retrieve the input values for the function(s) this class implements.
Method Summary
protected abstract ObjectexecuteFunction(String expression, Object value)
Execute the function referenced in the last-processed expression using the value resolved from the current expression (using the embedded ValueSource).
ObjectgetValue(String expression)
  1. Resolve the current expression using the embedded ValueSource
  2. Retrieve the last expression processed by this value source
  3. Pass the last expression (which should be the function name), along with the value for the current expression, into the executeFunction(..) method
  4. Return the result of the executeFunction(..) as the resolved value for the current expression.
protected ValueSourcegetValueSource()
Retrieve the embedded value source.

Constructor Detail

AbstractFunctionValueSourceWrapper

protected AbstractFunctionValueSourceWrapper(ValueSource valueSource)
Construct a new function value source instance, using the supplied ValueSource to retrieve the input values for the function(s) this class implements.

Parameters: valueSource The value source to wrap

Method Detail

executeFunction

protected abstract Object executeFunction(String expression, Object value)
Execute the function referenced in the last-processed expression using the value resolved from the current expression (using the embedded ValueSource).

Parameters: expression The last expression to be processed by this value source. value The value for the current expression, resolved by the embedded ValueSource

Returns: The result of modifying the current expression's value using the function named by the last expression.

getValue

public Object getValue(String expression)
  1. Resolve the current expression using the embedded ValueSource
  2. Retrieve the last expression processed by this value source
  3. Pass the last expression (which should be the function name), along with the value for the current expression, into the executeFunction(..) method
  4. Return the result of the executeFunction(..) as the resolved value for the current expression.

getValueSource

protected ValueSource getValueSource()
Retrieve the embedded value source.
Copyright © 2001-2009 Codehaus. All Rights Reserved.