Object convertSafe(Object source, Class<?> target) throws Exception { Hints hints = new Hints(); hints.put(ConverterFactory.SAFE_CONVERSION, new Boolean(true)); return factory.createConverter(source.getClass(), target, hints).convert(source, target); }
Object convert(Object source, Class target) throws Exception { return factory.createConverter(source.getClass(), target, null).convert(source, target); }