/** * {@inheritDoc} */ @Override public Long getDefaultValue() { return fromString(defaultValue); }
/** * {@inheritDoc} */ @Override protected void setDefaultValue(Long defaultValue) { this.defaultValue = toString(defaultValue.longValue()); }
@Test public void bytePropertyUpdateXmlSaveLoad() throws PropertyValidationException, JAXBException { long bytes = (10 * 1024 * 1024) + 2; // 10MBs + 2 bytes ByteProperty byteProperty = new ByteProperty("name", "description", "logical-name", Long.valueOf(1), false, false); AbstractPropertyUpdate<Long> bytePropertyUpdate = byteProperty.createAndValidatePropertyUpdate(Long.valueOf(bytes)); JAXBContext context = JAXBContext.newInstance(BytePropertyUpdate.class); Marshaller marshaller = context.createMarshaller(); Unmarshaller unmarshaller = context.createUnmarshaller(); marshaller.marshal(bytePropertyUpdate, f); Object object = unmarshaller.unmarshal(f); assertThat(object, is(instanceOf(BytePropertyUpdate.class))); BytePropertyUpdate unmarsalled = (BytePropertyUpdate) object; assertThat(byteProperty.canUpdate(unmarsalled), is(true)); byteProperty.setValue(unmarsalled.getUpdateValue()); assertThat(byteProperty.getValue().longValue(), is(bytes)); }
@Test public void bytePropertyXmlSaveLoad() throws JAXBException { long bytes = (10 * 1024 * 1024) + 2; // 10MBs + 2 bytes ByteProperty byteProperty = new ByteProperty("name", "description", "logical-name", Long.valueOf(bytes), false, false); JAXBContext context = JAXBContext.newInstance(ByteProperty.class); Marshaller marshaller = context.createMarshaller(); Unmarshaller unmarshaller = context.createUnmarshaller(); marshaller.marshal(byteProperty, f); Object object = unmarshaller.unmarshal(f); assertThat(object, is(instanceOf(ByteProperty.class))); ByteProperty unmarsalled = (ByteProperty) object; assertThat(unmarsalled.getDefaultValue(), is(Long.valueOf(bytes))); }
/** * {@inheritDoc} */ @Override protected void showDefaultValue() { displayValue(property.getDefaultValue().longValue()); }
}); displayValue(property.getValue().longValue());
/** * {@inheritDoc} */ @Override protected Long getUsedValue() { if (null != usedValue) { return fromString(usedValue); } return null; }
/** * {@inheritDoc} */ @Override protected void setUsedValue(Long usedValue) { if (null != usedValue) { this.usedValue = toString(usedValue.longValue()); } else { this.usedValue = null; // NOPMD } }
/** * Gets {@link #updateValue}. * * @return {@link #updateValue} */ @Override public Long getUpdateValue() { return ByteProperty.fromString(updateValue); }
/** * Sets {@link #updateValue}. * * @param updateValue * New value for {@link #updateValue} */ @Override protected void setUpdateValue(Long updateValue) { if (null != updateValue) { this.updateValue = ByteProperty.toString(updateValue.longValue()); // NOPMD } } }
/** * {@inheritDoc} */ @Override public Long parseLiteral(String literal) { return fromString(literal); }