DmrModelString extends DmrModelValue implements ModelString { @Override public <T extends ModelValue> T asValue(Class<T> valueType) { if (ModelNumber.class.isAssignableFrom(valueType)) { return valueType.cast(new DmrModelNumber(value)); } else { return super.asValue(valueType); } } DmrModelString(final ModelNode value); @Override String getValue(); @Override ModelString set(String value); @Override T asValue(Class<T> valueType);  }
@Test public void testAsValue() { ModelString expected = modelString(); ModelString actual = expected.asValue(ModelString.class); assertTrue(expected == actual); }