@Override public TField readFieldBegin() throws TException { // slight hack to communicate to DynamicSerDe that the field ids are not // being set but things are ordered. f = new TField("", ORDERED_TYPE, (short) -1); return f; }
@Override public TField readFieldBegin() throws TException { assert (!inner); TField f = new TField("", ORDERED_TYPE, (short) -1); // slight hack to communicate to DynamicSerDe that the field ids are not // being set but things are ordered. return f; }
field = new TField(mt.name, mt.getType(), (short) mt.fieldid); oprot.writeFieldBegin(field);
@Override public TField readFieldBegin() throws TException { if (!getCurrentContext().hasMoreChildren()) { return new TField("", UNUSED_TYPE, (short) 0); } getCurrentContext().read(); final JsonNode jsonName = getCurrentContext().getCurrentChild(); if (!jsonName.isTextual()) { throw new RuntimeException("Expected String for a field name"); } final String fieldName = jsonName.asText(); currentFieldClass.push(getCurrentContext().getClassByFieldName(fieldName)); return getCurrentContext().getTFieldByName(fieldName); }
public TField readFieldBegin() throws TException { byte type = readByte(); short id = type == TType.STOP ? 0 : readI16(); return new TField("", type, id); }
/** * Read a field header off the wire. */ public TField readFieldBegin() throws TException { byte type = readByte(); // if it's a stop, then we can return immediately, as the struct is over. if (type == TType.STOP) { return TSTOP; } short fieldId; // mask off the 4 MSB of the type header. it could contain a field id delta. short modifier = (short)((type & 0xf0) >> 4); if (modifier == 0) { // not a delta. look ahead for the zigzag varint field id. fieldId = readI16(); } else { // has a delta. add the delta to the last read field id. fieldId = (short)(lastFieldId_ + modifier); } TField field = new TField("", getTType((byte)(type & 0x0f)), fieldId); // if this happens to be a boolean field, the value is encoded in the type if (isBoolType(type)) { // save the boolean value in a special instance variable. boolValue_ = (byte)(type & 0x0f) == Types.BOOLEAN_TRUE ? Boolean.TRUE : Boolean.FALSE; } // push the new field onto the field stack so we can keep the deltas going. lastFieldId_ = field.id; return field; }
@Override public TField readFieldBegin() throws TException { byte ch = reader_.peek(); byte type; short id = 0; if (ch == RBRACE[0]) { type = TType.STOP; } else { id = (short) readJSONInteger(); readJSONObjectStart(); type = getTypeIDForTypeName(readJSONString(false).get()); } return new TField("", type, id); }
@Override public TField readFieldBegin() throws TException { assert (!inner); TField f = new TField("", ORDERED_TYPE, (short) -1); // slight hack to communicate to DynamicSerDe that the field ids are not // being set but things are ordered. return f; }
public void writeStringField(String name, short id, String string) throws TException { if (string == null) { return; } protocol.writeFieldBegin(new TField(name, TType.STRING, id)); protocol.writeString(string); protocol.writeFieldEnd(); }
public void writeI16Field(String name, short id, short i16) throws TException { protocol.writeFieldBegin(new TField(name, TType.I16, id)); protocol.writeI16(i16); protocol.writeFieldEnd(); }
public void writeDoubleArrayField(String name, short id, double[] array) throws Exception { if (array == null) { return; } protocol.writeFieldBegin(new TField(name, TType.LIST, id)); writeDoubleArray(array); protocol.writeFieldEnd(); }
public void writeI16ArrayField(String name, short id, short[] array) throws Exception { if (array == null) { return; } protocol.writeFieldBegin(new TField(name, TType.LIST, id)); writeI16Array(array); protocol.writeFieldEnd(); }
public void writeI32ArrayField(String name, short id, int[] array) throws Exception { if (array == null) { return; } protocol.writeFieldBegin(new TField(name, TType.LIST, id)); writeI32Array(array); protocol.writeFieldEnd(); }
public void writeI64ArrayField(String name, short id, long[] array) throws Exception { if (array == null) { return; } protocol.writeFieldBegin(new TField(name, TType.LIST, id)); writeI64Array(array); protocol.writeFieldEnd(); }
public <E> void writeSetField(String name, short id, ThriftCodec<Set<E>> codec, Set<E> set) throws Exception { if (set == null) { return; } protocol.writeFieldBegin(new TField(name, TType.SET, id)); codec.write(set, protocol); protocol.writeFieldEnd(); }
public <K, V> void writeMapField(String name, short id, ThriftCodec<Map<K, V>> codec, Map<K, V> map) throws Exception { if (map == null) { return; } protocol.writeFieldBegin(new TField(name, TType.MAP, id)); codec.write(map, protocol); protocol.writeFieldEnd(); }
public <T extends Enum<T>> void writeEnumField(String name, short id, ThriftCodec<T> codec, T enumValue) throws Exception { if (enumValue == null) { return; } protocol.writeFieldBegin(new TField(name, TType.I32, id)); codec.write(enumValue, protocol); protocol.writeFieldEnd(); }
@Override public TField readFieldBegin() throws TException { return new TField(field.getName(), thriftType, field.getFieldId()); } }
@Override public TField readFieldBegin() throws TException { return new TField(field.getName(), thriftType, field.getFieldId()); } }