Package org.springframework.binding.mapping.impl

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


    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


   */
  protected 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

    } 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(input, mapping);
    parseAndSetMappingRequired(input, mapping);
    return mapping;
  }
View Full Code Here

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

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

    } 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

public class DefaultMapperTests extends TestCase {
  private DefaultMapper mapper = new DefaultMapper();
  private ExpressionParser parser = new SpringELExpressionParser(new SpelExpressionParser());

  public void testMapping() {
    DefaultMapping mapping1 = new DefaultMapping(parser.parseExpression("foo", null), parser.parseExpression("bar",
        null));
    DefaultMapping mapping2 = new DefaultMapping(parser.parseExpression("foo", null), parser.parseExpression("baz",
        null));
    mapper.addMapping(mapping1);
    mapper.addMapping(mapping2);
    assertEquals(2, mapper.getMappings().length);
    TestBean bean1 = new TestBean();
View Full Code Here

      }
    }).size());
  }

  public void testMappingConversion() {
    DefaultMapping mapping1 = new DefaultMapping(parser.parseExpression("beep", null), parser.parseExpression(
        "beep", null));
    mapper.addMapping(mapping1);
    Map<String, String> bean1 = new HashMap<String, String>();
    bean1.put("beep", "en");
    TestBean2 bean2 = new TestBean2();
View Full Code Here

    assertFalse(results.hasErrorResults());
    assertEquals(Locale.ENGLISH, bean2.beep);
  }

  public void testMappingConversionError() {
    DefaultMapping mapping1 = new DefaultMapping(parser.parseExpression("boop", null), parser.parseExpression(
        "boop", null));
    mapper.addMapping(mapping1);
    Map<String, String> bean1 = new HashMap<String, String>();
    bean1.put("boop", "bogus");
    TestBean2 bean2 = new TestBean2();
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.