@Override @SuppressWarnings("unchecked") public Object convert(Object object) throws TypeException { if (object instanceof Map) { Map<Object, Object> map = (Map<Object, Object>) object; for (Entry<Object, Object> entry : map.entrySet()) { String key = entry.getKey().toString(); Field field = getField(key); if (field == null) { throw new IllegalArgumentException("Field " + key + " is not defined for the complex type " + getName()); } entry.setValue(field.getType().convert(entry.getValue())); } return object; } throw new TypeException("Incompatible object: " + object.getClass() + " for type " + this); }