Package org.springframework.context.expression

Examples of org.springframework.context.expression.MapAccessor


        StandardEvaluationContext evaluationContext = (StandardEvaluationContext) getServletContext().getAttribute(EVALUATION_CONTEXT_KEY);
        if (evaluationContext == null) {
            evaluationContext = new StandardEvaluationContext();
            evaluationContext.addPropertyAccessor(new NavigatorPropertyAccessor());
            evaluationContext.addPropertyAccessor(new ServletPropertyAccessor());
            evaluationContext.addPropertyAccessor(new MapAccessor());
            //
            getServletContext().setAttribute(EVALUATION_CONTEXT_KEY, evaluationContext);
        }
        return evaluationContext;
    }
View Full Code Here


    LinkedHashMap<String, List<String>> map = new LinkedHashMap<String, List<String>>();
    // map.put("foo", Arrays.asList("bar"));
    target.setNested(map);
    SpelExpressionParser parser = new SpelExpressionParser();
    StandardEvaluationContext context = new StandardEvaluationContext(target);
    context.addPropertyAccessor(new MapAccessor());
    Expression expression = parser.parseExpression("nested.foo");
    assertNotNull(expression.getValue(context));
  }
View Full Code Here

    private EvaluationContext getEvaluationContext() {
        if (evaluationContext == null) {
            evaluationContext = new StandardEvaluationContext();
            evaluationContext.addPropertyAccessor(new BeanExpressionContextAccessor());
            evaluationContext.addPropertyAccessor(new MapAccessor());
        }
        return evaluationContext;
    }
View Full Code Here

    private PlaceholderResolver resolver;

    public SpelView(String template) {
      this.template = template;
      this.context.addPropertyAccessor(new MapAccessor());
      this.helper = new PropertyPlaceholderHelper("${", "}");
      this.resolver = new SpelPlaceholderResolver(this.context);
    }
View Full Code Here

    Assert.notNull(configuration, "Hadoop configuration must not be null");

    fsShell = new FsShell(configuration);

    this.evaluationContext.addPropertyAccessor(new MapAccessor());

    final BeanFactory beanFactory = this.getBeanFactory();

    if (beanFactory != null) {
      this.evaluationContext.setBeanResolver(new BeanFactoryResolver(
View Full Code Here

    Assert.notNull(configuration, "Hadoop configuration must not be null");

    fsShell = new FsShell(configuration);

    this.evaluationContext.addPropertyAccessor(new MapAccessor());

    final BeanFactory beanFactory = this.getBeanFactory();

    if (beanFactory != null) {
      this.evaluationContext.setBeanResolver(new BeanFactoryResolver(
View Full Code Here

      ThreadLocal<StandardEvaluationContext> evaluationContext = new ThreadLocal<StandardEvaluationContext>() {
        @Override
        protected StandardEvaluationContext initialValue() {
          StandardEvaluationContext ec = new StandardEvaluationContext();
          if (useMapAccessor) {
            ec.addPropertyAccessor(new MapAccessor());
          }
          if (useBeanAccessor) {
            ec.addPropertyAccessor(new BeanFactoryAccessor());
            ec.setRootObject(applicationContext);
          }
          if (useBeanResolver) {
            ec.setBeanResolver(new BeanFactoryResolver(applicationContext));
          }
          if (defaultRootObject != null) {
            ec.setRootObject(defaultRootObject);
            if (!useMapAccessor && defaultRootObject instanceof Map)
              ec.addPropertyAccessor(new MapAccessor());
          }
          return ec;
        }
      };
     
      ThreadLocal<Expression> expression = new ThreadLocal<Expression>();

      @Override
      public SpelEvaluator setVariables(Map<String, Object> variables) {
        evaluationContext.get().setVariables(variables);
        evaluationContext.get().addPropertyAccessor(new MapAccessor());
        return this;
      }
     
      @Override
      public SpelEvaluator setVariable(String name, Object value) {
        evaluationContext.get().setVariable(name, value);
        return this;
      }
     
      @Override
      public SpelEvaluator setRootObject(Object rootObject) {
        evaluationContext.get().setRootObject(rootObject);
        if (!useMapAccessor && rootObject instanceof Map) {
          evaluationContext.get().addPropertyAccessor(new MapAccessor());
        }
        return this;
      }
     
      private boolean isExpression(String expressionString) {
View Full Code Here

  }

  @Override
  public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
    this.evaluationContext.setBeanResolver(new BeanFactoryResolver(beanFactory));
    this.evaluationContext.addPropertyAccessor(new MapAccessor());
  }
View Full Code Here

TOP

Related Classes of org.springframework.context.expression.MapAccessor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.