@VisibleForTesting @SuppressWarnings({ "rawtypes", "unchecked" }) public Function<HttpResponse, ?> getTransformerForMethod(Invocation invocation, Injector injector) { Invokable<?, ?> invoked = invocation.getInvokable(); Function<HttpResponse, ?> transformer; if (invoked.isAnnotationPresent(SelectJson.class)) { Type returnVal = getReturnTypeFor(invoked.getReturnType()); if (invoked.isAnnotationPresent(OnlyElement.class)) returnVal = newParameterizedType(Set.class, returnVal); transformer = new ParseFirstJsonValueNamed(injector.getInstance(GsonWrapper.class), TypeLiteral.get(returnVal), invoked.getAnnotation(SelectJson.class).value()); if (invoked.isAnnotationPresent(OnlyElement.class)) transformer = compose(new OnlyElementOrNull(), transformer); } else { transformer = injector.getInstance(getParserOrThrowException(invocation)); } return transformer; }
@VisibleForTesting @SuppressWarnings({ "rawtypes", "unchecked" }) public Function<HttpResponse, ?> getTransformerForMethod(Invocation invocation, Injector injector) { Invokable<?, ?> invoked = invocation.getInvokable(); Function<HttpResponse, ?> transformer; if (invoked.isAnnotationPresent(SelectJson.class)) { Type returnVal = getReturnTypeFor(invoked.getReturnType()); if (invoked.isAnnotationPresent(OnlyElement.class)) returnVal = newParameterizedType(Set.class, returnVal); transformer = new ParseFirstJsonValueNamed(injector.getInstance(GsonWrapper.class), TypeLiteral.get(returnVal), invoked.getAnnotation(SelectJson.class).value()); if (invoked.isAnnotationPresent(OnlyElement.class)) transformer = compose(new OnlyElementOrNull(), transformer); } else { transformer = injector.getInstance(getParserOrThrowException(invocation)); } return transformer; }
@VisibleForTesting @SuppressWarnings({ "rawtypes", "unchecked" }) public Function<HttpResponse, ?> getTransformerForMethod(Invocation invocation, Injector injector) { Invokable<?, ?> invoked = invocation.getInvokable(); Function<HttpResponse, ?> transformer; if (invoked.isAnnotationPresent(SelectJson.class)) { Type returnVal = getReturnTypeFor(invoked.getReturnType()); if (invoked.isAnnotationPresent(OnlyElement.class)) returnVal = newParameterizedType(Set.class, returnVal); transformer = new ParseFirstJsonValueNamed(injector.getInstance(GsonWrapper.class), TypeLiteral.get(returnVal), invoked.getAnnotation(SelectJson.class).value()); if (invoked.isAnnotationPresent(OnlyElement.class)) transformer = compose(new OnlyElementOrNull(), transformer); } else { transformer = injector.getInstance(getParserOrThrowException(invocation)); } return transformer; }
@VisibleForTesting @SuppressWarnings({ "rawtypes", "unchecked" }) public Function<HttpResponse, ?> getTransformerForMethod(Invocation invocation, Injector injector) { Invokable<?, ?> invoked = invocation.getInvokable(); Function<HttpResponse, ?> transformer; if (invoked.isAnnotationPresent(SelectJson.class)) { Type returnVal = getReturnTypeFor(invoked.getReturnType()); if (invoked.isAnnotationPresent(OnlyElement.class)) returnVal = newParameterizedType(Set.class, returnVal); transformer = new ParseFirstJsonValueNamed(injector.getInstance(GsonWrapper.class), TypeLiteral.get(returnVal), invoked.getAnnotation(SelectJson.class).value()); if (invoked.isAnnotationPresent(OnlyElement.class)) transformer = compose(new OnlyElementOrNull(), transformer); } else { transformer = injector.getInstance(getParserOrThrowException(invocation)); } return transformer; }
@VisibleForTesting @SuppressWarnings({ "rawtypes", "unchecked" }) public Function<HttpResponse, ?> getTransformerForMethod(Invocation invocation, Injector injector) { Invokable<?, ?> invoked = invocation.getInvokable(); Function<HttpResponse, ?> transformer; if (invoked.isAnnotationPresent(SelectJson.class)) { Type returnVal = getReturnTypeFor(invoked.getReturnType()); if (invoked.isAnnotationPresent(OnlyElement.class)) returnVal = newParameterizedType(Set.class, returnVal); transformer = new ParseFirstJsonValueNamed(injector.getInstance(GsonWrapper.class), TypeLiteral.get(returnVal), invoked.getAnnotation(SelectJson.class).value()); if (invoked.isAnnotationPresent(OnlyElement.class)) transformer = compose(new OnlyElementOrNull(), transformer); } else { transformer = injector.getInstance(getParserOrThrowException(invocation)); } return transformer; }
@VisibleForTesting @SuppressWarnings({ "rawtypes", "unchecked" }) public Function<HttpResponse, ?> getTransformerForMethod(Invocation invocation, Injector injector) { Invokable<?, ?> invoked = invocation.getInvokable(); Function<HttpResponse, ?> transformer; if (invoked.isAnnotationPresent(SelectJson.class)) { Type returnVal = getReturnTypeFor(invoked.getReturnType()); if (invoked.isAnnotationPresent(OnlyElement.class)) returnVal = newParameterizedType(Set.class, returnVal); transformer = new ParseFirstJsonValueNamed(injector.getInstance(GsonWrapper.class), TypeLiteral.get(returnVal), invoked.getAnnotation(SelectJson.class).value()); if (invoked.isAnnotationPresent(OnlyElement.class)) transformer = Functions.compose(new OnlyElementOrNull(), transformer); } else { transformer = injector.getInstance(getParserOrThrowException(invocation)); } return transformer; }