@Test public void testMap() throws SecurityException, NoSuchMethodException { ForwardingRuleCreationBinder binder = new ForwardingRuleCreationBinder(json); ForwardingRuleCreationOptions forwardingRuleCreationOptions = new ForwardingRuleCreationOptions.Builder() .description(DESCRIPTION) .ipAddress(IP_ADDRESS) .ipProtocol(ForwardingRule.IPProtocol.SCTP) .portRange(PORT_RANGE) .target(TARGET) .build(); HttpRequest request = HttpRequest.builder().method("GET").endpoint("http: Map<String, Object> postParams = ImmutableMap.of("name", "testForwardingRuleName", "options", forwardingRuleCreationOptions); binder.bindToRequest(request, postParams); assertEquals(request.getPayload().getRawContent(), "{\"" + "name\":\"testForwardingRuleName\"," + "\"description\":\"" + DESCRIPTION + "\"," + "\"ipAddress\":\"" + IP_ADDRESS + "\"," + "\"ipProtocol\":\"SCTP\"," + "\"portRange\":\"" + PORT_RANGE + "\"," + "\"target\":\"" + TARGET + "\"" + "}"); assertEquals(request.getPayload().getContentMetadata().getContentType(), "application/json"); }
@Override public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) { ForwardingRuleCreationOptions options = (ForwardingRuleCreationOptions) postParams.get("options"); String name = postParams.get("name").toString(); ForwardingRuleCreationBinderHelper forwardingRuleCreationBinderHelper = new ForwardingRuleCreationBinderHelper(name, options); return super.bindToRequest(request, forwardingRuleCreationBinderHelper); }
ForwardingRuleCreationBinder extends BindToJsonPayload { @Override public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) { ForwardingRuleCreationOptions options = (ForwardingRuleCreationOptions) postParams.get("options"); String name = postParams.get("name").toString(); ForwardingRuleCreationBinderHelper forwardingRuleCreationBinderHelper = new ForwardingRuleCreationBinderHelper(name, options); return super.bindToRequest(request, forwardingRuleCreationBinderHelper); } }
ForwardingRuleCreationBinder extends BindToJsonPayload { @Override public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) { ForwardingRuleCreationOptions options = (ForwardingRuleCreationOptions) postParams.get("options"); String name = postParams.get("name").toString(); ForwardingRuleCreationBinderHelper forwardingRuleCreationBinderHelper = new ForwardingRuleCreationBinderHelper(name, options); return super.bindToRequest(request, forwardingRuleCreationBinderHelper); } @Inject  ForwardingRuleCreationBinder(Json jsonBinder); }
ForwardingRuleCreationBinder extends BindToJsonPayload { @Override public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) { ForwardingRuleCreationOptions options = (ForwardingRuleCreationOptions) postParams.get("options"); String name = postParams.get("name").toString(); ForwardingRuleCreationBinderHelper forwardingRuleCreationBinderHelper = new ForwardingRuleCreationBinderHelper(name, options); return super.bindToRequest(request, forwardingRuleCreationBinderHelper); } @Inject  ForwardingRuleCreationBinder(Json jsonBinder); @Override R bindToRequest(R request, Map<String, Object> postParams); }
ForwardingRuleCreationBinder extends BindToJsonPayload { @Override public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) { ForwardingRuleCreationOptions options = (ForwardingRuleCreationOptions) postParams.get("options"); String name = postParams.get("name").toString(); ForwardingRuleCreationBinderHelper forwardingRuleCreationBinderHelper = new ForwardingRuleCreationBinderHelper(name, options); return super.bindToRequest(request, forwardingRuleCreationBinderHelper); } @Inject  ForwardingRuleCreationBinder(Json jsonBinder); @Override R bindToRequest(R request, Map<String, Object> postParams);  }