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