/** * Factory method that creates the conversion service the flow builder will use. Subclasses may override. The * default implementation registers Web Flow-specific converters thought to be useful for most builder * implementations, setting the externally-provided builder services conversion service as its parent. * @return the flow builder conversion service */ protected ConversionService createConversionService() { GenericConversionService service = new GenericConversionService( getFlowBuilderServices().getConversionService().getDelegateConversionService()); service.addConverter(new TextToTransitionCriteria(this)); service.addConverter(new TextToTargetStateResolver(this)); service.setParent(new ParentConversionServiceProxy()); return service; }
/** * Factory method that creates the conversion service the flow builder will use. Subclasses may override. The * default implementation registers Web Flow-specific converters thought to be useful for most builder * implementations, setting the externally-provided builder services conversion service as its parent. * @return the flow builder conversion service */ protected ConversionService createConversionService() { GenericConversionService service = new GenericConversionService(); service.addConverter(new TextToTransitionCriteria(this)); service.addConverter(new TextToTargetStateResolver(this)); service.setParent(new ParentConversionServiceProxy()); return service; }
/** * Factory method that creates the conversion service the flow builder will use. Subclasses may override. The * default implementation registers Web Flow-specific converters thought to be useful for most builder * implementations, setting the externally-provided builder services conversion service as its parent. * @return the flow builder conversion service */ protected ConversionService createConversionService() { GenericConversionService service = new GenericConversionService( getFlowBuilderServices().getConversionService().getDelegateConversionService()); service.addConverter(new TextToTransitionCriteria(this)); service.addConverter(new TextToTargetStateResolver(this)); service.setParent(new ParentConversionServiceProxy()); return service; }
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"); }
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; }
public void testRegisterConverter() { GenericConversionService service = new GenericConversionService(); FormattedStringToNumber converter = new FormattedStringToNumber(); DefaultNumberFormatFactory numberFormatFactory = new DefaultNumberFormatFactory(); numberFormatFactory.setLocale(Locale.US); converter.setNumberFormatFactory(numberFormatFactory); service.addConverter(converter); ConversionExecutor executor = service.getConversionExecutor(String.class, Integer.class); Integer three = (Integer) executor.execute("3,000"); assertEquals(new Integer(3000), three); ConversionExecutor executor2 = service.getConversionExecutor(Integer.class, String.class); String string = (String) executor2.execute(3000); assertEquals("3,000", string); }