@Test public void testGetBody() throws Exception { Inventory update = new Inventory(); update.setIdentifier(123); update.setPrice(new BigDecimal("1.00")); String body = new UpdateInventoryRequest(update, "inventory_id", "unit_price").getBody(); assertEquals("{\"inventory_id\":123,\"unit_price\":1.00}", body); }
@Override public String getBody() throws Exception { Set<String> properties = new HashSet<String>(); for (String field : fields) { properties.add(field); } SimpleBeanPropertyFilter filter = new SimpleBeanPropertyFilter.FilterExceptFilter(properties); SimpleFilterProvider provider = new SimpleFilterProvider(); provider.addFilter("update inventory request filter", filter); return mapper.writer(provider).writeValueAsString(inventory); }
UpdateInventoryRequest extends AbstractPutRequest<UpdateInventoryResponse> { @Override public String getBody() throws Exception { Set<String> properties = new HashSet<String>(); for (String field : fields) { properties.add(field); } SimpleBeanPropertyFilter filter = new SimpleBeanPropertyFilter.FilterExceptFilter(properties); SimpleFilterProvider provider = new SimpleFilterProvider(); provider.addFilter("update inventory request filter", filter); return mapper.writer(provider).writeValueAsString(inventory); } }
UpdateInventoryRequest extends AbstractPutRequest<UpdateInventoryResponse> { @Override public String getBody() throws Exception { Set<String> properties = new HashSet<String>(); for (String field : fields) { properties.add(field); } SimpleBeanPropertyFilter filter = new SimpleBeanPropertyFilter.FilterExceptFilter(properties); SimpleFilterProvider provider = new SimpleFilterProvider(); provider.addFilter("update inventory request filter", filter); return mapper.writer(provider).writeValueAsString(inventory); } UpdateInventoryRequest(Inventory inventory, String... fields); }
UpdateInventoryRequest extends AbstractPutRequest<UpdateInventoryResponse> { @Override public String getBody() throws Exception { Set<String> properties = new HashSet<String>(); for (String field : fields) { properties.add(field); } SimpleBeanPropertyFilter filter = new SimpleBeanPropertyFilter.FilterExceptFilter(properties); SimpleFilterProvider provider = new SimpleFilterProvider(); provider.addFilter("update inventory request filter", filter); return mapper.writer(provider).writeValueAsString(inventory); } UpdateInventoryRequest(Inventory inventory, String... fields); @Override String getPath(); @Override Parameter[] getParameters(); @Override String getBody(); @Override UpdateInventoryParser getParser(); }
UpdateInventoryRequest extends AbstractPutRequest<UpdateInventoryResponse> { @Override public String getBody() throws Exception { Set<String> properties = new HashSet<String>(); for (String field : fields) { properties.add(field); } SimpleBeanPropertyFilter filter = new SimpleBeanPropertyFilter.FilterExceptFilter(properties); SimpleFilterProvider provider = new SimpleFilterProvider(); provider.addFilter("update inventory request filter", filter); return mapper.writer(provider).writeValueAsString(inventory); } UpdateInventoryRequest(Inventory inventory, String... fields); @Override String getPath(); @Override Parameter[] getParameters(); @Override String getBody(); @Override UpdateInventoryParser getParser();  }