org.springjutsu.validation.spel
Class NamedScopeEvaluationContext

java.lang.Object
  extended by org.springframework.expression.spel.support.StandardEvaluationContext
      extended by org.springjutsu.validation.spel.NamedScopeEvaluationContext
All Implemented Interfaces:
org.springframework.expression.EvaluationContext

public class NamedScopeEvaluationContext
extends org.springframework.expression.spel.support.StandardEvaluationContext

Acts as Multiple SPEL Evaluation Contexts from a single instance. Allows multiple "scopes" to each be given a name. When searching for properties within the Evaluation Context, the named scopes will be searched in the order they were registered. If the property being sought is qualified with the scope name, then the appropriate scope will be directly accessed. This allows this class to: 1) Be a work around for the reversed order of class-matching property accessors, reported in SPR-8211, and 2) Allow the creation of multiple named contexts without having to create a dedicated class with named fields for each of the scopes, and 3) Allows for full use of property accessors against each registered scope.

Author:
Clark Duplichien

Constructor Summary
NamedScopeEvaluationContext()
          Creates an empty instance, on which scopes can be registered.
 
Method Summary
 void addContext(String contextName, Object context)
          Adds a Scope, or Context, however you term it.
 
Methods inherited from class org.springframework.expression.spel.support.StandardEvaluationContext
addConstructorResolver, addMethodResolver, addPropertyAccessor, getBeanResolver, getConstructorResolvers, getMethodResolvers, getOperatorOverloader, getPropertyAccessors, getRootObject, getTypeComparator, getTypeConverter, getTypeLocator, lookupVariable, registerFunction, registerMethodFilter, removeConstructorResolver, removeMethodResolver, removePropertyAccessor, setBeanResolver, setConstructorResolvers, setMethodResolvers, setOperatorOverloader, setPropertyAccessors, setRootObject, setRootObject, setTypeComparator, setTypeConverter, setTypeLocator, setVariable, setVariables
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NamedScopeEvaluationContext

public NamedScopeEvaluationContext()
Creates an empty instance, on which scopes can be registered. By ensuring a @see{MapAccessor} is registered, we allow the hack that is the @see{ContextScope} class to work.

Method Detail

addContext

public void addContext(String contextName,
                       Object context)
Adds a Scope, or Context, however you term it.

Parameters:
contextName - The name of the context / scope.
context - The context / scope object itself.


Copyright © 2013 Spring Jutsu. All Rights Reserved.