@Override public byte get(Object o) { return ((ByteOption) o).get(); } }
@Override Object extract(ByteOption holder) { return holder.get(); } });
@Override protected Number get(ByteOption property) { return property.get(); }
@Override protected void doEmitDefault(ByteOption property, StringBuilder output) { output.append(property.get()); }
@Override public Object getPrimitiveJavaObject(Object o) { ByteOption object = (ByteOption) o; if (object == null || object.isNull()) { return null; } return object.get(); }
@Override public void write(Object value, RecordConsumer consumer) { consumer.addInteger(((ByteOption) value).get()); } },
@Override protected void doWrite(ByteOption property, ValueWriter writer) throws IOException { writer.writeInt(property.get()); }
@Override public void emit(ByteOption option) throws IOException { startCell(); if (emitNull(option)) { return; } lineBuffer.append(option.get()); }
@Override public Object getPrimitiveWritableObject(Object o) { ByteOption object = (ByteOption) o; if (object == null || object.isNull()) { return null; } return new ByteWritable(object.get()); }
/** * test for get. */ @Test public void get() { ByteOption option = new ByteOption(); option.modify((byte) 100); assertThat(option.get(), is((byte) 100)); assertThat(option.isNull(), is(false)); }
assertThat(option.get(), is((byte) 0)); assertThat(option.get(), is((byte) 1)); assertThat(option.get(), is((byte) 50)); assertThat(option.get(), is((byte) -1)); assertThat(option.get(), is((byte) -50)); assertThat(option.get(), is((byte) 127)); assertThat(option.get(), is((byte) -128)); assertThat(option.get(), is((byte) 0)); assertThat(option.get(), is((byte) 0));
/** * test for parsing {@code byte} value. * @throws Exception if failed */ @Test public void fillByte() throws Exception { ByteOption value = new ByteOption(); create("byte"); assertThat(parser.next(), is(true)); parser.fill(value); assertThat(value.get(), is((byte) 0)); parser.fill(value); assertThat(value.get(), is((byte) 10)); parser.fill(value); assertThat(value.get(), is((byte) -10)); parser.endRecord(); assertThat(parser.next(), is(true)); parser.fill(value); assertThat(value.isNull(), is(true)); parser.fill(value); assertThat(value.get(), is(Byte.MAX_VALUE)); parser.fill(value); assertThat(value.get(), is(Byte.MIN_VALUE)); parser.endRecord(); assertThat(parser.next(), is(false)); }
assertThat(parser.next(), is(true)); parser.fill(value); assertThat(value.get(), is((byte) 0)); parser.fill(value); assertThat(value.get(), is((byte) 10)); parser.fill(value); assertThat(value.get(), is((byte) -10)); assertThat(value.isNull(), is(true)); parser.fill(value); assertThat(value.get(), is(Byte.MAX_VALUE)); parser.fill(value); assertThat(value.get(), is(Byte.MIN_VALUE));