@Test public void writeNull() { DoubleOption option = new DoubleOption(); DoubleOption restored = restore(option); assertThat(restored.isNull(), is(true)); }
@SuppressWarnings("deprecation") @Override public int restore(byte[] bytes, int offset, int limit) throws IOException { if (limit - offset == 0) { throw new IOException(MessageFormat.format( "Cannot restore a double field ({0})", "invalid length")); } if (bytes[offset + 0] == 0) { setNull(); return 1; } else if (limit - offset >= 1 + 1) { modify(decode(ByteArrayUtil.readLong(bytes, offset + 1))); return 8 + 1; } else { throw new IOException(MessageFormat.format( "Cannot restore a double field ({0})", "invalid length")); } }
DoubleOption extends ValueOption<DoubleOption> { @SuppressWarnings("deprecation") @Override public int restore(byte[] bytes, int offset, int limit) throws IOException { if (limit - offset == 0) { throw new IOException(MessageFormat.format( "Cannot restore a double field ({0})", "invalid length")); } if (bytes[offset + 0] == 0) { setNull(); return 1; } else if (limit - offset >= 1 + 1) { modify(decode(ByteArrayUtil.readLong(bytes, offset + 1))); return 8 + 1; } else { throw new IOException(MessageFormat.format( "Cannot restore a double field ({0})", "invalid length")); } } }
DoubleOption extends ValueOption<DoubleOption> { @SuppressWarnings("deprecation") @Override public int restore(byte[] bytes, int offset, int limit) throws IOException { if (limit - offset == 0) { throw new IOException(MessageFormat.format( "Cannot restore a double field ({0})", "invalid length")); } if (bytes[offset + 0] == 0) { setNull(); return 1; } else if (limit - offset >= 1 + 1) { modify(decode(ByteArrayUtil.readLong(bytes, offset + 1))); return 8 + 1; } else { throw new IOException(MessageFormat.format( "Cannot restore a double field ({0})", "invalid length")); } } DoubleOption();  DoubleOption(double value); }
DoubleOption extends ValueOption<DoubleOption> { @SuppressWarnings("deprecation") @Override public int restore(byte[] bytes, int offset, int limit) throws IOException { if (limit - offset == 0) { throw new IOException(MessageFormat.format( "Cannot restore a double field ({0})", "invalid length")); } if (bytes[offset + 0] == 0) { setNull(); return 1; } else if (limit - offset >= 1 + 1) { modify(decode(ByteArrayUtil.readLong(bytes, offset + 1))); return 8 + 1; } else { throw new IOException(MessageFormat.format( "Cannot restore a double field ({0})", "invalid length")); } } DoubleOption();  DoubleOption(double value); double get(); double or(double alternate); void add(double delta); void add(DoubleOption other); @Deprecated DoubleOption modify(double newValue); @Override @Deprecated void copyFrom(DoubleOption optionOrNull); @Override int hashCode(); @Override boolean equals(Object obj); boolean has(double other); @Override int compareTo(WritableRawComparable o); @Override String toString(); @Override void write(DataOutput out); @SuppressWarnings("deprecation") @Override void readFields(DataInput in); @SuppressWarnings("deprecation") @Override int restore(byte[] bytes, int offset, int limit); @Override int getSizeInBytes(byte[] buf, int offset); @Override int compareInBytes(byte[] b1, int o1, byte[] b2, int o2); static int getBytesLength(byte[] bytes, int offset, int length); static int compareBytes(
            byte[] b1, int s1, int l1,
            byte[] b2, int s2, int l2); }
DoubleOption extends ValueOption<DoubleOption> { @SuppressWarnings("deprecation") @Override public int restore(byte[] bytes, int offset, int limit) throws IOException { if (limit - offset == 0) { throw new IOException(MessageFormat.format( "Cannot restore a double field ({0})", "invalid length")); } if (bytes[offset + 0] == 0) { setNull(); return 1; } else if (limit - offset >= 1 + 1) { modify(decode(ByteArrayUtil.readLong(bytes, offset + 1))); return 8 + 1; } else { throw new IOException(MessageFormat.format( "Cannot restore a double field ({0})", "invalid length")); } } DoubleOption();  DoubleOption(double value); double get(); double or(double alternate); void add(double delta); void add(DoubleOption other); @Deprecated DoubleOption modify(double newValue); @Override @Deprecated void copyFrom(DoubleOption optionOrNull); @Override int hashCode(); @Override boolean equals(Object obj); boolean has(double other); @Override int compareTo(WritableRawComparable o); @Override String toString(); @Override void write(DataOutput out); @SuppressWarnings("deprecation") @Override void readFields(DataInput in); @SuppressWarnings("deprecation") @Override int restore(byte[] bytes, int offset, int limit); @Override int getSizeInBytes(byte[] buf, int offset); @Override int compareInBytes(byte[] b1, int o1, byte[] b2, int o2); static int getBytesLength(byte[] bytes, int offset, int length); static int compareBytes(
            byte[] b1, int s1, int l1,
            byte[] b2, int s2, int l2);  }