Interface VariableResolverFactory

All Superinterfaces:
Serializable
All Known Implementing Classes:
BaseVariableResolverFactory, CachedMapVariableResolverFactory, CachingMapVariableResolverFactory, ClassImportResolverFactory, DefaultLocalVariableResolverFactory, FunctionVariableResolverFactory, ImmutableDefaultFactory, IndexedVariableResolverFactory, InvokationContextFactory, ItemResolverFactory, MapVariableResolverFactory, Proto.ProtoContextFactory, SimpleVariableResolverFactory, StackDelimiterResolverFactory, StackDemarcResolverFactory, StackResetResolverFactory, StaticMethodImportResolverFactory, TypeInjectionResolverFactoryImpl

public interface VariableResolverFactory extends Serializable
A VariableResolverFactory is the primary integration point for tying in external variables. The factory is responsible for returing VariableResolver's to the MVEL runtime. Factories are also structured in a chain to maintain locality-of-reference.
  • Method Details

    • createVariable

      VariableResolver createVariable(String name, Object value)
      Creates a new variable. This probably doesn't need to be implemented in most scenarios. This is used for variable assignment.
      Parameters:
      name - - name of the variable being created
      value - - value of the variable
      Returns:
      instance of the variable resolver associated with the variable
    • createIndexedVariable

      VariableResolver createIndexedVariable(int index, String name, Object value)
    • createVariable

      VariableResolver createVariable(String name, Object value, Class<?> type)
      Creates a new variable, and assigns a static type. It is expected the underlying factory and resolver will enforce this.
      Parameters:
      name - - name of the variable being created
      value - - value of the variable
      type - - the static type
      Returns:
      instance of the variable resolver associated with the variable
    • createIndexedVariable

      VariableResolver createIndexedVariable(int index, String name, Object value, Class<?> typee)
    • setIndexedVariableResolver

      VariableResolver setIndexedVariableResolver(int index, VariableResolver variableResolver)
    • getNextFactory

      VariableResolverFactory getNextFactory()
      Returns the next factory in the factory chain. MVEL uses a hierarchical variable resolution strategy, much in the same way as Classloaders in Java. For performance reasons, it is the responsibility of the individual VariableResolverFactory to pass off to the next one.
      Returns:
      instance of the next factory - null if none.
    • setNextFactory

      VariableResolverFactory setNextFactory(VariableResolverFactory resolverFactory)
      Sets the next factory in the chain. Proper implementation: return this.nextFactory = resolverFactory;
      Parameters:
      resolverFactory - - instance of next resolver factory
      Returns:
      - instance of next resolver factory
    • getVariableResolver

      VariableResolver getVariableResolver(String name)
      Return a variable resolver for the specified variable name. This method is expected to traverse the heirarchy of ResolverFactories.
      Parameters:
      name - - variable name
      Returns:
      - instance of the VariableResolver for the specified variable
    • getIndexedVariableResolver

      VariableResolver getIndexedVariableResolver(int index)
    • isTarget

      boolean isTarget(String name)
      Deterimines whether or not the current VariableResolverFactory is the physical target for the actual variable.
      Parameters:
      name - - variable name
      Returns:
      - boolean indicating whether or not factory is the physical target
    • isResolveable

      boolean isResolveable(String name)
      Determines whether or not the variable is resolver in the chain of factories.
      Parameters:
      name - - variable name
      Returns:
      - boolean
    • getKnownVariables

      Set<String> getKnownVariables()
      Return a list of known variables inside the factory. This method should not recurse into other factories. But rather return only the variables living inside this factory.
      Returns:
      variables
    • variableIndexOf

      int variableIndexOf(String name)
    • isIndexedFactory

      boolean isIndexedFactory()
    • tiltFlag

      boolean tiltFlag()
    • setTiltFlag

      void setTiltFlag(boolean tilt)