@Test public void testFromJson() throws Exception { String json = "{\"page\" : {\n" + " \"name\" : \"home\",\n" + " \"_ref\" : \"/pages/home\"\n" + "}}"; ModelObject model = DmrModelValue.readFromJsonStream(new ByteArrayInputStream(json.getBytes()), ModelObject.class); ModelReference pageRef = model.get("page", ModelReference.class); assertNotNull(pageRef); assertEquals(pageRef.get("name", ModelString.class).getValue(), "home"); assertEquals(PathAddress.pathAddress("pages", "home"), pageRef.getValue()); }
@Override public PathAddress getValue() { if (value.hasDefined("_ref")) { return PathAddress.pathAddress(value.get("_ref").asString()); } else { return null; } }
DmrModelReference extends DmrModelObject implements ModelReference { @Override public PathAddress getValue() { if (value.hasDefined("_ref")) { return PathAddress.pathAddress(value.get("_ref").asString()); } else { return null; } } }
DmrModelReference extends DmrModelObject implements ModelReference { @Override public PathAddress getValue() { if (value.hasDefined("_ref")) { return PathAddress.pathAddress(value.get("_ref").asString()); } else { return null; } } DmrModelReference(ModelNode value); }
DmrModelReference extends DmrModelObject implements ModelReference { @Override public PathAddress getValue() { if (value.hasDefined("_ref")) { return PathAddress.pathAddress(value.get("_ref").asString()); } else { return null; } } DmrModelReference(ModelNode value); @Override PathAddress getValue(); @Override ModelReference set(PathAddress address); }
DmrModelReference extends DmrModelObject implements ModelReference { @Override public PathAddress getValue() { if (value.hasDefined("_ref")) { return PathAddress.pathAddress(value.get("_ref").asString()); } else { return null; } } DmrModelReference(ModelNode value); @Override PathAddress getValue(); @Override ModelReference set(PathAddress address);  }