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