@Test public void test_updatesNumberAttribute() throws Exception { final JsonRootNode node = aJsonObject( aJsonField("attribute", aJsonNumber(new BigInteger("10")))); final Record record = new Record(); updater.update(record, node); assertEquals(new Long(new BigInteger("10").longValue()), record.getAttributeAsLong("attribute")); }
public void update(final Record record, JsonNode node) { update(node, new JSONAdapter() { @Override public void addBooleanField(String name, Boolean value) { record.setAttribute(name, value); } @Override public void addNumberField(String name, BigInteger value) { record.setAttribute(name, value.longValue()); } @Override public void addNumberField(String name, BigDecimal value) { record.setAttribute(name, value.doubleValue()); } @Override public void addStringField(String name, String value) { record.setAttribute(name, value); } @Override public void addNullField(String name) { record.setAttribute(name, (Object) null); } @Override public void addObjectField(String name, Map<String, Object> value) { record.setAttribute(name, value); } }); }
RecordJSONUpdater { public void update(final Record record, JsonNode node) { update(node, new JSONAdapter() { @Override public void addBooleanField(String name, Boolean value) { record.setAttribute(name, value); } @Override public void addNumberField(String name, BigInteger value) { record.setAttribute(name, value.longValue()); } @Override public void addNumberField(String name, BigDecimal value) { record.setAttribute(name, value.doubleValue()); } @Override public void addStringField(String name, String value) { record.setAttribute(name, value); } @Override public void addNullField(String name) { record.setAttribute(name, (Object) null); } @Override public void addObjectField(String name, Map<String, Object> value) { record.setAttribute(name, value); } }); } }
RecordJSONUpdater { public void update(final Record record, JsonNode node) { update(node, new JSONAdapter() { @Override public void addBooleanField(String name, Boolean value) { record.setAttribute(name, value); } @Override public void addNumberField(String name, BigInteger value) { record.setAttribute(name, value.longValue()); } @Override public void addNumberField(String name, BigDecimal value) { record.setAttribute(name, value.doubleValue()); } @Override public void addStringField(String name, String value) { record.setAttribute(name, value); } @Override public void addNullField(String name) { record.setAttribute(name, (Object) null); } @Override public void addObjectField(String name, Map<String, Object> value) { record.setAttribute(name, value); } }); }  }
RecordJSONUpdater { public void update(final Record record, JsonNode node) { update(node, new JSONAdapter() { @Override public void addBooleanField(String name, Boolean value) { record.setAttribute(name, value); } @Override public void addNumberField(String name, BigInteger value) { record.setAttribute(name, value.longValue()); } @Override public void addNumberField(String name, BigDecimal value) { record.setAttribute(name, value.doubleValue()); } @Override public void addStringField(String name, String value) { record.setAttribute(name, value); } @Override public void addNullField(String name) { record.setAttribute(name, (Object) null); } @Override public void addObjectField(String name, Map<String, Object> value) { record.setAttribute(name, value); } }); }  void update(final Record record, JsonNode node); }
RecordJSONUpdater { public void update(final Record record, JsonNode node) { update(node, new JSONAdapter() { @Override public void addBooleanField(String name, Boolean value) { record.setAttribute(name, value); } @Override public void addNumberField(String name, BigInteger value) { record.setAttribute(name, value.longValue()); } @Override public void addNumberField(String name, BigDecimal value) { record.setAttribute(name, value.doubleValue()); } @Override public void addStringField(String name, String value) { record.setAttribute(name, value); } @Override public void addNullField(String name) { record.setAttribute(name, (Object) null); } @Override public void addObjectField(String name, Map<String, Object> value) { record.setAttribute(name, value); } }); }  void update(final Record record, JsonNode node);  }