Gson gson = builder.create();
final Parameter[] parameterNames = paramNameProvider.parametersFor(method.getMethod());
final Object[] values = new Object[parameterNames.length];
final Deserializee deserializee = deserializeeInstance.get();
try {
String content = getContentOfStream(inputStream);
logger.debug("json retrieved: {}", content);
if (!isNullOrEmpty(content)) {
JsonParser parser = new JsonParser();
JsonElement jsonElement = parser.parse(content);
if (jsonElement.isJsonObject()) {
JsonObject root = jsonElement.getAsJsonObject();
deserializee.setWithoutRoot(isWithoutRoot(parameterNames, root));
for(Class<? extends DeserializerConfig> option: method.getMethod().getAnnotation(Consumes.class).options()) {
DeserializerConfig config = container.instanceFor(option);
config.config(deserializee);
}
for (int i = 0; i < types.length; i++) {
Parameter parameter = parameterNames[i];
JsonElement node = root.get(parameter.getName());
if (deserializee.isWithoutRoot()) {
values[i] = gson.fromJson(root, parameter.getParameterizedType());
logger.info("json without root deserialized");
break;
} else if (node != null) {