@Test public void testAsValue() { ModelNumber expected = modelNumber(); ModelNumber actual = expected.asValue(ModelNumber.class); assertTrue(expected == actual); }
@Override public <T extends ModelValue> T asValue(Class<T> valueType) { if (ModelString.class.isAssignableFrom(valueType)) { return valueType.cast(new DmrModelString(new ModelNode(value.asString()))); } else { return super.asValue(valueType); } }
DmrModelNumber extends DmrModelValue implements ModelNumber { @Override public <T extends ModelValue> T asValue(Class<T> valueType) { if (ModelString.class.isAssignableFrom(valueType)) { return valueType.cast(new DmrModelString(new ModelNode(value.asString()))); } else { return super.asValue(valueType); } } }
DmrModelNumber extends DmrModelValue implements ModelNumber { @Override public <T extends ModelValue> T asValue(Class<T> valueType) { if (ModelString.class.isAssignableFrom(valueType)) { return valueType.cast(new DmrModelString(new ModelNode(value.asString()))); } else { return super.asValue(valueType); } } DmrModelNumber(final ModelNode value); }
DmrModelNumber extends DmrModelValue implements ModelNumber { @Override public <T extends ModelValue> T asValue(Class<T> valueType) { if (ModelString.class.isAssignableFrom(valueType)) { return valueType.cast(new DmrModelString(new ModelNode(value.asString()))); } else { return super.asValue(valueType); } } DmrModelNumber(final ModelNode value); @Override int getInt(); @Override ModelNumber set(int value); @Override long getLong(); @Override ModelNumber set(long value); @Override double getDouble(); @Override ModelNumber set(double value); @Override BigInteger getBigInteger(); @Override ModelNumber set(BigInteger value); @Override BigDecimal getBigDecimal(); @Override ModelNumber set(BigDecimal value); @Override ModelNumberType getNumberType(); @Override T asValue(Class<T> valueType); }
DmrModelNumber extends DmrModelValue implements ModelNumber { @Override public <T extends ModelValue> T asValue(Class<T> valueType) { if (ModelString.class.isAssignableFrom(valueType)) { return valueType.cast(new DmrModelString(new ModelNode(value.asString()))); } else { return super.asValue(valueType); } } DmrModelNumber(final ModelNode value); @Override int getInt(); @Override ModelNumber set(int value); @Override long getLong(); @Override ModelNumber set(long value); @Override double getDouble(); @Override ModelNumber set(double value); @Override BigInteger getBigInteger(); @Override ModelNumber set(BigInteger value); @Override BigDecimal getBigDecimal(); @Override ModelNumber set(BigDecimal value); @Override ModelNumberType getNumberType(); @Override T asValue(Class<T> valueType);  }