Class DefaultVariableProvider
- java.lang.Object
-
- org.vedantatree.expressionoasis.extensions.DefaultVariableProvider
-
- All Implemented Interfaces:
VariableProvider
public class DefaultVariableProvider extends Object implements VariableProvider
This is the default implementation of the variable provider.
-
-
Constructor Summary
Constructors Constructor Description DefaultVariableProvider()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addVariable(String variableName, ValueObject valueObject)
Add a new variable value to Variable Provider Cachevoid
clear()
Clears the variable names.Type
getVariableType(String variableName)
Gets the type of variable.ValueObject
getVariableValue(String variableName)
Gets the value of variable.void
initialize(ExpressionContext expressionContext)
It initialize the Function provider with expression context and also gives a chance to pre-initialize any internal states for operationsvoid
removeVariable(String variableName)
Removes the variable from Variable Provider Cache by given nameboolean
supportsVariable(String variableName)
Checks whether the specified variable is supported by this variable provider or not.
-
-
-
Method Detail
-
initialize
public void initialize(ExpressionContext expressionContext) throws ExpressionEngineException
It initialize the Function provider with expression context and also gives a chance to pre-initialize any internal states for operations- Specified by:
initialize
in interfaceVariableProvider
- Parameters:
expressionContext
- Context of current expression evaluation process- Throws:
ExpressionEngineException
-
addVariable
public void addVariable(String variableName, ValueObject valueObject)
Add a new variable value to Variable Provider Cache- Parameters:
variableName
- name of the variable to addvalueObject
- value of the variable
-
removeVariable
public void removeVariable(String variableName)
Removes the variable from Variable Provider Cache by given name- Parameters:
variableName
- name of the the variable to remove
-
clear
public void clear()
Clears the variable names.
-
getVariableType
public Type getVariableType(String variableName) throws ExpressionEngineException
Description copied from interface:VariableProvider
Gets the type of variable.- Specified by:
getVariableType
in interfaceVariableProvider
- Parameters:
variableName
- name of the variable- Returns:
- type of the variable
- Throws:
ExpressionEngineException
- if anything goes wrong- See Also:
VariableProvider.getVariableType(java.lang.String)
-
getVariableValue
public ValueObject getVariableValue(String variableName) throws ExpressionEngineException
Description copied from interface:VariableProvider
Gets the value of variable.- Specified by:
getVariableValue
in interfaceVariableProvider
- Parameters:
variableName
- name of the variable.- Returns:
- value of variable wrapped in
ValueObject
- Throws:
ExpressionEngineException
- if anything goes wrong- See Also:
VariableProvider.getVariableValue(java.lang.String)
-
supportsVariable
public boolean supportsVariable(String variableName) throws ExpressionEngineException
Description copied from interface:VariableProvider
Checks whether the specified variable is supported by this variable provider or not.- Specified by:
supportsVariable
in interfaceVariableProvider
- Parameters:
variableName
- name of the variable- Returns:
true
if the variable is supported by this providerfalse
otherwise- Throws:
ExpressionEngineException
- if anything goes wrong- See Also:
VariableProvider.supportsVariable(java.lang.String)
-
-