@Test @SuppressWarnings("unchecked") public void shouldInvokePrimitiveConverter() throws OgnlException { when(converters.to(int.class)).thenReturn(converter); when(converter.convert("2", int.class, bundle)).thenReturn(2); Map<?,?> context = Ognl.createDefaultContext(myCat); Ognl.setTypeConverter(context, adapter); Ognl.setValue("length", context, myCat, "2"); assertThat(myCat.length, is(equalTo(2))); }
Object convert(Object value, Class type) { Converter<?> converter = converters.to(type); if (converter == null) { throw new IllegalArgumentException("Cannot instantiate a converter for type " + type.getName()); } return converter.convert((String) value, type, bundle); }
VRaptorConvertersAdapter implements TypeConverter { Object convert(Object value, Class type) { Converter<?> converter = converters.to(type); if (converter == null) { throw new IllegalArgumentException("Cannot instantiate a converter for type " + type.getName()); } return converter.convert((String) value, type, bundle); } }
VRaptorConvertersAdapter implements TypeConverter { Object convert(Object value, Class type) { Converter<?> converter = converters.to(type); if (converter == null) { throw new IllegalArgumentException("Cannot instantiate a converter for type " + type.getName()); } return converter.convert((String) value, type, bundle); } VRaptorConvertersAdapter(Converters converters, ResourceBundle bundle); }
VRaptorConvertersAdapter implements TypeConverter { Object convert(Object value, Class type) { Converter<?> converter = converters.to(type); if (converter == null) { throw new IllegalArgumentException("Cannot instantiate a converter for type " + type.getName()); } return converter.convert((String) value, type, bundle); } VRaptorConvertersAdapter(Converters converters, ResourceBundle bundle); Object convertValue(Map context, Object target, Member member, String propertyName, Object value,
		Class toType); }
VRaptorConvertersAdapter implements TypeConverter { Object convert(Object value, Class type) { Converter<?> converter = converters.to(type); if (converter == null) { throw new IllegalArgumentException("Cannot instantiate a converter for type " + type.getName()); } return converter.convert((String) value, type, bundle); } VRaptorConvertersAdapter(Converters converters, ResourceBundle bundle); Object convertValue(Map context, Object target, Member member, String propertyName, Object value,
		Class toType);  }