Class AbstractFunctionValueSourceWrapper
- java.lang.Object
-
- org.codehaus.plexus.interpolation.AbstractFunctionValueSourceWrapper
-
- All Implemented Interfaces:
ValueSource
public abstract class AbstractFunctionValueSourceWrapper extends java.lang.Object implements ValueSource
ValueSourceabstract 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 methodexecuteFunction(String, Object)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.
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractFunctionValueSourceWrapper(ValueSource valueSource)Construct a new function value source instance, using the suppliedValueSourceto retrieve the input values for the function(s) this class implements.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract java.lang.ObjectexecuteFunction(java.lang.String expression, java.lang.Object value)Execute the function referenced in the last-processed expression using the value resolved from the current expression (using the embeddedValueSource).java.lang.ObjectgetValue(java.lang.String expression)Resolve the current expression using the embeddedValueSourceRetrieve the last expression processed by this value source Pass the last expression (which should be the function name), along with the value for the current expression, into the executeFunction(..) method Return the result of the executeFunction(..) as the resolved value for the current expression.protected ValueSourcegetValueSource()Retrieve the embedded value source.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.codehaus.plexus.interpolation.ValueSource
clearFeedback, getFeedback, getValue
-
-
-
-
Constructor Detail
-
AbstractFunctionValueSourceWrapper
protected AbstractFunctionValueSourceWrapper(ValueSource valueSource)
Construct a new function value source instance, using the suppliedValueSourceto retrieve the input values for the function(s) this class implements.- Parameters:
valueSource- The value source to wrap
-
-
Method Detail
-
getValue
public java.lang.Object getValue(java.lang.String expression)
- Resolve the current expression using the embedded
ValueSource - Retrieve the last expression processed by this value source
- Pass the last expression (which should be the function name), along with the value for the current expression, into the executeFunction(..) method
- Return the result of the executeFunction(..) as the resolved value for the current expression.
- Specified by:
getValuein interfaceValueSource- Parameters:
expression- The string expression.- Returns:
- the value related to the expression, or
nullif not found. - See Also:
ValueSource.getValue(String, String, String)
- Resolve the current expression using the embedded
-
getValueSource
protected ValueSource getValueSource()
Retrieve the embedded value source.- Returns:
ValueSource
-
executeFunction
protected abstract java.lang.Object executeFunction(java.lang.String expression, java.lang.Object value)Execute the function referenced in the last-processed expression using the value resolved from the current expression (using the embeddedValueSource).- Parameters:
expression- The last expression to be processed by this value source.value- The value for the current expression, resolved by the embeddedValueSource- Returns:
- The result of modifying the current expression's value using the function named by the last expression.
-
-