Source:
public <T> T invoke(Context context, Class<T> classOfT) { T t = null; try { t = classOfT.newInstance(); } catch (InstantiationException | IllegalAccessException e) { logger.error("Can't create new instance of class {}", classOfT.getName(), e); return null; } Set<String> declaredFields = getAllDeclaredFieldsAsStringSet(classOfT); for (Entry<String, String[]> ent : context.getParameters().entrySet()) { if (declaredFields.contains(ent.getKey())) { try { Field field = classOfT.getDeclaredField(ent.getKey()); Class<?> fieldType = field.getType(); field.setAccessible(true); String[] values = ent.getValue(); if (Collection.class.isAssignableFrom(fieldType) || List.class.isAssignableFrom(fieldType)) { ListParamParser<?> parser = (ListParamParser<?>) ParamParsers.getListParser(getGenericType(field)); if (parser == null) { logger.warn("No parser defined for a collection of type {}", getGenericType(field).getCanonicalName()); } else { field.set(t, parser.parseParameter(field.getName(), values, context.getValidation())); } } else if (fieldType.isArray()) { ArrayParamParser<?> parser = ParamParsers.getArrayParser(fieldType, this.injector); if (parser == null) { logger.warn("No parser defined for an array of type {}", fieldType.getComponentType().getCanonicalName()); } else { field.set(t, parser.parseParameter(field.getName(), values, context.getValidation())); } } else { ParamParser<?> parser = (ParamParser<?>) ParamParsers.getParamParser(fieldType, injector); if (parser == null) { logger.warn("No parser defined for type {}", fieldType.getCanonicalName()); } else { field.set(t, parser.parseParameter(field.getName(), values[0], context.getValidation())); } } } catch (NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException e) { logger.warn( "Error parsing incoming Post request into class {}. Key and value {}.", classOfT.getName(), ent.getKey(), ent.getValue(), e); } } } return t; }

Target:
public <T> T invoke(Context context, Class<T> classOfT) { T t = null; try { t = classOfT.newInstance(); } catch (InstantiationException | IllegalAccessException e) { logger.error("Can't create new instance of class {}", classOfT.getName(), e); return null; } Set<String> declaredFields = getAllDeclaredFieldsAsStringSet(classOfT); for (Entry<String, String[]> ent : context.getParameters().entrySet()) { if (declaredFields.contains(ent.getKey())) { try { Field field = classOfT.getDeclaredField(ent.getKey()); Class<?> fieldType = field.getType(); field.setAccessible(true); String[] values = ent.getValue(); if (Collection.class.isAssignableFrom(fieldType) || List.class.isAssignableFrom(fieldType)) { ListParamParser<?> parser = (ListParamParser<?>) paramParsers.getListParser(getGenericType(field)); if (parser == null) { logger.warn("No parser defined for a collection of type {}", getGenericType(field).getCanonicalName()); } else { field.set(t, parser.parseParameter(field.getName(), values, context.getValidation())); } } else if (fieldType.isArray()) { ArrayParamParser<?> parser = paramParsers.getArrayParser(fieldType); if (parser == null) { logger.warn("No parser defined for an array of type {}", fieldType.getComponentType().getCanonicalName()); } else { field.set(t, parser.parseParameter(field.getName(), values, context.getValidation())); } } else { ParamParser<?> parser = (ParamParser<?>) paramParsers.getParamParser(fieldType); if (parser == null) { logger.warn("No parser defined for type {}", fieldType.getCanonicalName()); } else { field.set(t, parser.parseParameter(field.getName(), values[0], context.getValidation())); } } } catch (NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException e) { logger.warn( "Error parsing incoming Post request into class {}. Key and value {}.", classOfT.getName(), ent.getKey(), ent.getValue(), e); } } } return t; }