@Test(expectedExceptions = NullPointerException.class) public void testNullIsBad() { BindMapToStringPayload binder = binder(); HttpRequest request = HttpRequest.builder().method("GET").endpoint("http: binder.bindToRequest(request, null); }
@SuppressWarnings("unchecked") @Override public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) { checkNotNull(postParams, "postParams"); GeneratedHttpRequest r = GeneratedHttpRequest.class.cast(checkNotNull(request, "request")); Invokable<?, ?> invoked = r.getInvocation().getInvokable(); checkArgument(invoked.isAnnotationPresent(Payload.class), "method %s must have @Payload annotation to use this binder", invoked); String payload = invoked.getAnnotation(Payload.class).value(); if (!postParams.isEmpty()) { payload = urlDecode(expand(payload, postParams)); } return (R) request.toBuilder().payload(payload).build(); }
BindMapToStringPayload implements MapBinder { @SuppressWarnings("unchecked") @Override public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) { checkNotNull(postParams, "postParams"); GeneratedHttpRequest r = GeneratedHttpRequest.class.cast(checkNotNull(request, "request")); Invokable<?, ?> invoked = r.getInvocation().getInvokable(); checkArgument(invoked.isAnnotationPresent(Payload.class), "method %s must have @Payload annotation to use this binder", invoked); String payload = invoked.getAnnotation(Payload.class).value(); if (!postParams.isEmpty()) { payload = urlDecode(expand(payload, postParams)); } return (R) request.toBuilder().payload(payload).build(); } }
BindMapToStringPayload implements MapBinder { @SuppressWarnings("unchecked") @Override public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) { checkNotNull(postParams, "postParams"); GeneratedHttpRequest r = GeneratedHttpRequest.class.cast(checkNotNull(request, "request")); Invokable<?, ?> invoked = r.getInvocation().getInvokable(); checkArgument(invoked.isAnnotationPresent(Payload.class), "method %s must have @Payload annotation to use this binder", invoked); String payload = invoked.getAnnotation(Payload.class).value(); if (!postParams.isEmpty()) { payload = urlDecode(expand(payload, postParams)); } return (R) request.toBuilder().payload(payload).build(); }  }
BindMapToStringPayload implements MapBinder { @SuppressWarnings("unchecked") @Override public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) { checkNotNull(postParams, "postParams"); GeneratedHttpRequest r = GeneratedHttpRequest.class.cast(checkNotNull(request, "request")); Invokable<?, ?> invoked = r.getInvocation().getInvokable(); checkArgument(invoked.isAnnotationPresent(Payload.class), "method %s must have @Payload annotation to use this binder", invoked); String payload = invoked.getAnnotation(Payload.class).value(); if (!postParams.isEmpty()) { payload = urlDecode(expand(payload, postParams)); } return (R) request.toBuilder().payload(payload).build(); }  @SuppressWarnings("unchecked") @Override R bindToRequest(R request, Map<String, Object> postParams); @Override R bindToRequest(R request, Object payload); }
BindMapToStringPayload implements MapBinder { @SuppressWarnings("unchecked") @Override public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) { checkNotNull(postParams, "postParams"); GeneratedHttpRequest r = GeneratedHttpRequest.class.cast(checkNotNull(request, "request")); Invokable<?, ?> invoked = r.getInvocation().getInvokable(); checkArgument(invoked.isAnnotationPresent(Payload.class), "method %s must have @Payload annotation to use this binder", invoked); String payload = invoked.getAnnotation(Payload.class).value(); if (!postParams.isEmpty()) { payload = urlDecode(expand(payload, postParams)); } return (R) request.toBuilder().payload(payload).build(); }  @SuppressWarnings("unchecked") @Override R bindToRequest(R request, Map<String, Object> postParams); @Override R bindToRequest(R request, Object payload);  }