Class ExpressionContext

  • Direct Known Subclasses:
    CustomExpressionContext

    public class ExpressionContext
    extends Object
    Object of this class carry the contextual information for expressions during expression evaluation process. Like it can have information for variable providers, function providers and other properties. This is a thread safe object, hence can be used with multiple expression evaluation process at the same time in multiple threads. Care needs to be taken for the properties if threads are changing them at the same time. It may results in unexpected result.
    • Method Detail

      • addVariableProvider

        public void addVariableProvider​(VariableProvider variableProvider,
                                        String providerName)
      • addVariableProvider

        public void addVariableProvider​(VariableProvider variableProvider)
        Adds variable provider to the expression context.
        Parameters:
        variableProvider - the variable provider to add
      • getFunctionProviders

        public Collection<FunctionProvider> getFunctionProviders()
        Gets the collection of function providers. It is an unmodifiable list.
        Returns:
        Returns the functionProviders.
      • getVariableProviders

        public Collection<VariableProvider> getVariableProviders()
        Gets the collection of variable providers. It is an unmodifiable list.
        Returns:
        Returns the variableProviders
      • setContextProperty

        public void setContextProperty​(String propertyName,
                                       Object propertyValue)
        Sets the value for any context property.
        Parameters:
        propertyName - the name of property
        propertyValue - the value of property
      • getContextProperty

        public Object getContextProperty​(String propertyName)
        Returns the value for a property.
        Parameters:
        propertyName - the name of property
        Returns:
        the value corresponding to the property. null if no property exists in expression context
      • clearVariableProviders

        public void clearVariableProviders()
      • reset

        public void reset()
        Resets the expression context. Cleans all the states of this expression context for further reuse.