protected Object convertScalar(final Object source) { if (source == null) { return null; } final Converter converter = converterFactory.getConverter(source.getClass(), destClass); return converter.convert(source, destClass, createContext(source)); }
/** @throws Exception */ @SuppressWarnings("unchecked") public void testGetConverters() throws Exception { Map<String, Converter> converters = factory.getAnnotationReader().getConverters(Hoge.class); assertNotNull(converters); assertEquals(3, converters.size()); Converter converter = converters.get("foo"); assertNotNull(converter); assertEquals("foo", converter.convert("foo", String.class, null)); converter = converters.get("bar"); assertNotNull(converter); assertEquals("a_bar_b", converter.convert("bar", String.class, null)); converter = converters.get("baz"); assertNotNull(converter); assertEquals("baz", converter.convert("baz", String.class, null)); }
protected void convertScalar(final Object source, final Object dest) { assertSource(source); assertDest(dest); final Converter converter = converterFactory.getConverter(source.getClass(), dest.getClass()); converter.convert(source, dest, createContext(source)); }