Package org.springframework.binding.convert.converters

Examples of org.springframework.binding.convert.converters.StringToDate


public class StaticConversionExecutorImplTests extends TestCase {

  private StaticConversionExecutor conversionExecutor;

  protected void setUp() throws Exception {
    StringToDate stringToDate = new StringToDate();
    conversionExecutor = new StaticConversionExecutor(String.class, Date.class, stringToDate);
  }
View Full Code Here


    addConverter(new StringToFloat());
    addConverter(new StringToDouble());
    addConverter(new StringToBigInteger());
    addConverter(new StringToBigDecimal());
    addConverter(new StringToLocale());
    addConverter(new StringToDate());
    addConverter(new StringToLabeledEnum());
    addConverter(new ObjectToCollection(this));
    addConverter(new NumberToNumber());
    if (ClassUtils.isPresent("java.lang.Enum", this.getClass().getClassLoader())) {
      addConverter(new StringToEnum());
View Full Code Here

public class ApplicationConversionService extends DefaultConversionService {

    @Override
    protected void addDefaultConverters() {
  super.addDefaultConverters();
  StringToDate dateConverter = new StringToDate();
  dateConverter.setPattern("MM-dd-yyyy");
  addConverter("shortDate", dateConverter);
    }
View Full Code Here

    context.getMockFlowExecutionContext().setKey(new MockFlowExecutionKey("c1v1"));
    org.springframework.web.servlet.View mvcView = new MockView();
    AbstractMvcView view = new MockMvcView(mvcView, context);
    view.setExpressionParser(createExpressionParser());
    DefaultConversionService conversionService = new DefaultConversionService();
    StringToDate stringToDate = new StringToDate();
    stringToDate.setPattern("MM-dd-yyyy");
    conversionService.addConverter("customDateConverter", stringToDate);
    view.setConversionService(conversionService);
    BinderConfiguration binderConfiguration = new BinderConfiguration();
    binderConfiguration.addBinding(new Binding("dateProperty", "customDateConverter", true));
    view.setBinderConfiguration(binderConfiguration);
View Full Code Here

    assertEquals(validationHints, validator.hints);
    assertTrue(validator.invoked);
  }

  private SpringELExpressionParser createExpressionParser() {
    StringToDate c = new StringToDate();
    c.setPattern("yyyy-MM-dd");
    SpringELExpressionParser parser = new WebFlowSpringELExpressionParser(new SpelExpressionParser());
    GenericConversionService cs = (GenericConversionService) parser.getConversionService();
    cs.addConverter(c);
    return parser;
  }
View Full Code Here

    assertEquals(null, e.getValueType(bean));
  }

  public void testSetValueWithCoersion() {
    GenericConversionService cs = (GenericConversionService) parser.getConversionService();
    StringToDate converter = new StringToDate();
    converter.setPattern("yyyy-MM-dd");
    cs.addConverter(converter);
    Expression e = parser.parseExpression("date", null);
    e.setValue(bean, "2008-9-15");
  }
View Full Code Here

public class StaticConversionExecutorImplTests extends TestCase {

  private StaticConversionExecutor conversionExecutor;

  protected void setUp() throws Exception {
    StringToDate stringToDate = new StringToDate();
    conversionExecutor = new StaticConversionExecutor(String.class, Date.class, stringToDate);
  }
View Full Code Here

    assertEquals(5, context.getNumber());
  }

  public void testSetValueWithCoersion() {
    GenericConversionService cs = (GenericConversionService) parser.getConversionService();
    StringToDate converter = new StringToDate();
    converter.setPattern("yyyy-MM-dd");
    cs.addConverter(converter);
    Expression e = parser.parseExpression("date", null);
    e.setValue(bean, "2008-9-15");
  }
View Full Code Here

   */
  protected void addDefaultConverters() {
    super.addDefaultConverters();
   
    /* Add the "shortDate" conversion. */
    StringToDate dateAndTimeToDate = new StringToDate();
    dateAndTimeToDate.setPattern(DATE_AND_TIME_FORMAT);
    addConverter("date", dateAndTimeToDate);
  }
View Full Code Here

TOP

Related Classes of org.springframework.binding.convert.converters.StringToDate

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.