DmrModelObject extends DmrModelValue implements ModelObject { public ModelObject set(String name, String value) { get(name).set(value); return this; } DmrModelObject();   DmrModelObject(final ModelNode value); @Override Model get(String name); @Override Model get(String... names); @Override T get(String name, Class<T> valueType); ModelObject set(String name, String value); ModelObject set(String name, int value); @Override ModelObject set(String name, long value); @Override ModelObject set(String name, double value); @Override ModelObject set(String name, BigInteger value); @Override ModelObject set(String name, BigDecimal value); @Override ModelObject set(String name, boolean value); @Override ModelObject set(String name, PathAddress value); @Override boolean has(String name); @Override boolean hasDefined(String name); @Override ModelValue remove(String name); @Override T remove(String name, Class<T> valueType); @Override Set<String> getNames();  }
@Test public void testSet() { assertEquals("bar", modelObject().set("foo", "bar").get("foo", ModelString.class).getValue()); assertEquals(3, modelObject().set("foo", 3).get("foo", ModelNumber.class).getInt()); assertEquals(3L, modelObject().set("foo", 3).get("foo", ModelNumber.class).getLong()); assertEquals(3.14159265, modelObject().set("foo", 3.14159265).get("foo", ModelNumber.class).getDouble(), 0); assertEquals(BigInteger.valueOf(3), modelObject().set("foo", new BigInteger("3")).get("foo", ModelNumber.class).getBigInteger()); assertEquals(BigDecimal.valueOf(3.14159265), modelObject().set("foo", new BigDecimal("3.14159265")).get("foo", ModelNumber.class).getBigDecimal()); assertTrue(modelObject().set("foo", true).get("foo", ModelBoolean.class).getValue()); assertFalse(modelObject().set("foo", false).get("foo", ModelBoolean.class).getValue()); assertEquals(PathAddress.pathAddress("foo", "bar"), modelObject().set("foo", PathAddress.pathAddress("foo", "bar")).get("foo", ModelReference.class).getValue()); }