Package org.springframework.binding.mapping.impl

Examples of org.springframework.binding.mapping.impl.DefaultMapping


    } else {
      value = "flowScope." + name;
    }
    Expression source = parser.parseExpression(name, new FluentParserContext().evaluate(MutableAttributeMap.class));
    Expression target = parser.parseExpression(value, new FluentParserContext().evaluate(RequestContext.class));
    DefaultMapping mapping = new DefaultMapping(source, target);
    parseAndSetMappingConversionExecutor(output, mapping);
    parseAndSetMappingRequired(output, mapping);
    return mapping;
  }
View Full Code Here


  }
 
  private void addMapping(DefaultMapper mapper, String expressionString) {
    Expression expression = expressionParser.parseExpression(expressionString,
        new FluentParserContext().evaluate(RequestContext.class));
    DefaultMapping mapping = new DefaultMapping(expression, expression);
    mapping.setRequired(false);
    if (logger.isDebugEnabled()) {
      logger.debug("Adding mapping for expression '" + expressionString + "'");
    }
    mapper.addMapping(mapping);
  }
View Full Code Here

  private void addMapping(DefaultMapper mapper, Binding binding, Object model) {
    Expression source = new RequestParameterExpression(binding.getProperty());
    ParserContext parserContext = new FluentParserContext().evaluate(model.getClass());
    Expression target = expressionParser.parseExpression(binding.getProperty(), parserContext);
    DefaultMapping mapping = new DefaultMapping(source, target);
    mapping.setRequired(binding.getRequired());
    if (binding.getConverter() != null) {
      ConversionExecutor conversionExecutor = conversionService.getConversionExecutor(binding.getConverter(),
          String.class, target.getValueType(model));
      mapping.setTypeConverter(conversionExecutor);
    }
    if (logger.isDebugEnabled()) {
      logger.debug("Adding mapping for parameter '" + binding.getProperty() + "'");
    }
    mapper.addMapping(mapping);
View Full Code Here

    ParserContext parserContext = new FluentParserContext().evaluate(model.getClass());
    Expression target = expressionParser.parseExpression(field, parserContext);
    try {
      Class propertyType = target.getValueType(model);
      Expression source = new StaticExpression(getEmptyValue(propertyType));
      DefaultMapping mapping = new DefaultMapping(source, target);
      if (logger.isDebugEnabled()) {
        logger.debug("Adding empty value mapping for parameter '" + field + "'");
      }
      mapper.addMapping(mapping);
    } catch (EvaluationException e) {
View Full Code Here

  private void addDefaultMapping(DefaultMapper mapper, String parameter, Object model) {
    Expression source = new RequestParameterExpression(parameter);
    ParserContext parserContext = new FluentParserContext().evaluate(model.getClass());
    Expression target = expressionParser.parseExpression(parameter, parserContext);
    DefaultMapping mapping = new DefaultMapping(source, target);
    if (logger.isDebugEnabled()) {
      logger.debug("Adding default mapping for parameter '" + parameter + "'");
    }
    mapper.addMapping(mapping);
  }
View Full Code Here

    DefaultMapper attributeMapper = new DefaultMapper();
    ExpressionParser parser = new WebFlowSpringELExpressionParser(new SpelExpressionParser());
    Expression x = parser.parseExpression("attr", new FluentParserContext().evaluate(AttributeMap.class));
    Expression y = parser.parseExpression("flowScope.attr",
        new FluentParserContext().evaluate(RequestContext.class));
    attributeMapper.addMapping(new DefaultMapping(x, y));
    flow.setInputMapper(attributeMapper);
    MockRequestControlContext context = new MockRequestControlContext(flow);
    LocalAttributeMap<Object> sessionInput = new LocalAttributeMap<Object>();
    sessionInput.put("attr", "foo");
    flow.start(context, sessionInput);
View Full Code Here

    DefaultMapper attributeMapper = new DefaultMapper();
    ExpressionParser parser = new WebFlowSpringELExpressionParser(new SpelExpressionParser());
    Expression x = parser.parseExpression("attr", new FluentParserContext().evaluate(AttributeMap.class));
    Expression y = parser.parseExpression("flowScope.attr",
        new FluentParserContext().evaluate(RequestContext.class));
    attributeMapper.addMapping(new DefaultMapping(x, y));
    flow.setInputMapper(attributeMapper);
    MockRequestControlContext context = new MockRequestControlContext(flow);
    LocalAttributeMap<Object> sessionInput = new LocalAttributeMap<Object>();
    flow.start(context, sessionInput);
    assertTrue(context.getFlowScope().contains("attr"));
View Full Code Here

    DefaultMapper attributeMapper = new DefaultMapper();
    ExpressionParser parser = new WebFlowSpringELExpressionParser(new SpelExpressionParser());
    Expression x = parser.parseExpression("flowScope.attr",
        new FluentParserContext().evaluate(RequestContext.class));
    Expression y = parser.parseExpression("attr", new FluentParserContext().evaluate(MutableAttributeMap.class));
    attributeMapper.addMapping(new DefaultMapping(x, y));
    flow.setOutputMapper(attributeMapper);
    MockRequestControlContext context = new MockRequestControlContext(flow);
    context.getFlowScope().put("attr", "foo");
    LocalAttributeMap<Object> sessionOutput = new LocalAttributeMap<Object>();
    flow.end(context, "finish", sessionOutput);
View Full Code Here

    EndState state = new EndState(flow, "end");
    DefaultMapper mapper = new DefaultMapper();
    ExpressionParser parser = new WebFlowSpringELExpressionParser(new SpelExpressionParser());
    Expression x = parser.parseExpression("flowScope.x", new FluentParserContext().evaluate(RequestContext.class));
    Expression y = parser.parseExpression("y", new FluentParserContext().evaluate(MutableAttributeMap.class));
    mapper.addMapping(new DefaultMapping(x, y));
    state.setOutputMapper(mapper);
    MockRequestControlContext context = new MockRequestControlContext(flow);
    context.getFlowScope().put("x", "foo");
    state.enter(context);
  }
View Full Code Here

   */
  protected void addMapping(DefaultMapper mapper, Binding binding, Object model) {
    Expression source = new RequestParameterExpression(binding.getProperty());
    ParserContext parserContext = new FluentParserContext().evaluate(model.getClass());
    Expression target = expressionParser.parseExpression(binding.getProperty(), parserContext);
    DefaultMapping mapping = new DefaultMapping(source, target);
    mapping.setRequired(binding.getRequired());
    if (binding.getConverter() != null) {
      Assert.notNull(conversionService,
          "A ConversionService must be configured to use resolve custom converters to use during binding");
      ConversionExecutor conversionExecutor = conversionService.getConversionExecutor(binding.getConverter(),
          String.class, target.getValueType(model));
      mapping.setTypeConverter(conversionExecutor);
    }
    if (logger.isDebugEnabled()) {
      logger.debug("Adding mapping for parameter '" + binding.getProperty() + "'");
    }
    mapper.addMapping(mapping);
View Full Code Here

TOP

Related Classes of org.springframework.binding.mapping.impl.DefaultMapping

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.