List of usage examples for org.apache.thrift.protocol TType MAP
byte MAP
To view the source code for org.apache.thrift.protocol TType MAP.
Click Source Link
From source file:com.bigdata.dastor.thrift.AuthenticationRequest.java
License:Apache License
public void read(TProtocol iprot) throws TException { TField field;// w ww . j av a 2 s . co m iprot.readStructBegin(); while (true) { field = iprot.readFieldBegin(); if (field.type == TType.STOP) { break; } switch (field.id) { case 1: // CREDENTIALS if (field.type == TType.MAP) { { TMap _map16 = iprot.readMapBegin(); this.credentials = new HashMap<String, String>(2 * _map16.size); for (int _i17 = 0; _i17 < _map16.size; ++_i17) { String _key18; String _val19; _key18 = iprot.readString(); _val19 = iprot.readString(); this.credentials.put(_key18, _val19); } iprot.readMapEnd(); } } else { TProtocolUtil.skip(iprot, field.type); } break; default: TProtocolUtil.skip(iprot, field.type); } iprot.readFieldEnd(); } iprot.readStructEnd(); // check for required fields of primitive type, which can't be checked in the validate method validate(); }
From source file:com.ebay.nest.io.sede.dynamic_type.DynamicSerDeTypeMap.java
License:Apache License
@Override public byte getType() { return TType.MAP; }
From source file:com.ebay.nest.io.sede.thrift.TCTLSeparatedProtocol.java
License:Apache License
@Override public void writeMapBegin(TMap map) throws TException { // nesting not allowed! if (map.keyType == TType.STRUCT || map.keyType == TType.MAP || map.keyType == TType.LIST || map.keyType == TType.SET) { throw new TException("Not implemented: nested structures"); }//w w w. ja v a 2 s .c om // nesting not allowed! if (map.valueType == TType.STRUCT || map.valueType == TType.MAP || map.valueType == TType.LIST || map.valueType == TType.SET) { throw new TException("Not implemented: nested structures"); } firstInnerField = true; isMap = true; inner = true; elemIndex = 0; }
From source file:com.ebay.nest.io.sede.thrift.TCTLSeparatedProtocol.java
License:Apache License
@Override public void writeListBegin(TList list) throws TException { if (list.elemType == TType.STRUCT || list.elemType == TType.MAP || list.elemType == TType.LIST || list.elemType == TType.SET) { throw new TException("Not implemented: nested structures"); }//from ww w . java 2 s. c om firstInnerField = true; inner = true; }
From source file:com.ebay.nest.io.sede.thrift.TCTLSeparatedProtocol.java
License:Apache License
@Override public void writeSetBegin(TSet set) throws TException { if (set.elemType == TType.STRUCT || set.elemType == TType.MAP || set.elemType == TType.LIST || set.elemType == TType.SET) { throw new TException("Not implemented: nested structures"); }//from w w w.j a va 2 s . co m firstInnerField = true; inner = true; }
From source file:com.facebook.swift.codec.internal.TProtocolReader.java
License:Apache License
public <K, V> Map<K, V> readMapField(ThriftCodec<Map<K, V>> mapCodec) throws Exception { if (!checkReadState(TType.MAP)) { return null; }/* w w w. j a v a 2 s .c om*/ currentField = null; Map<K, V> fieldValue = mapCodec.read(protocol); protocol.readFieldEnd(); return fieldValue; }
From source file:com.facebook.swift.codec.internal.TProtocolWriter.java
License:Apache License
public <K, V> void writeMapField(String name, short id, ThriftCodec<Map<K, V>> codec, Map<K, V> map) throws Exception { if (map == null) { return;/*from w w w . j a v a 2 s . c o m*/ } protocol.writeFieldBegin(new TField(name, TType.MAP, id)); codec.write(map, protocol); protocol.writeFieldEnd(); }
From source file:com.inmobi.audit.thrift.AuditMessage.java
License:Apache License
public void read(TProtocol iprot) throws TException { TField field;/*from w w w . ja va 2 s.co m*/ iprot.readStructBegin(); while (true) { field = iprot.readFieldBegin(); if (field.type == TType.STOP) { break; } switch (field.id) { case 1: // TIMESTAMP if (field.type == TType.I64) { this.timestamp = iprot.readI64(); setTimestampIsSet(true); } else { TProtocolUtil.skip(iprot, field.type); } break; case 2: // TOPIC if (field.type == TType.STRING) { this.topic = iprot.readString(); } else { TProtocolUtil.skip(iprot, field.type); } break; case 3: // TIER if (field.type == TType.STRING) { this.tier = iprot.readString(); } else { TProtocolUtil.skip(iprot, field.type); } break; case 4: // HOSTNAME if (field.type == TType.STRING) { this.hostname = iprot.readString(); } else { TProtocolUtil.skip(iprot, field.type); } break; case 5: // WINDOW_SIZE if (field.type == TType.I32) { this.windowSize = iprot.readI32(); setWindowSizeIsSet(true); } else { TProtocolUtil.skip(iprot, field.type); } break; case 6: // RECEIVED if (field.type == TType.MAP) { { TMap _map0 = iprot.readMapBegin(); this.received = new HashMap<Long, Long>(2 * _map0.size); for (int _i1 = 0; _i1 < _map0.size; ++_i1) { long _key2; long _val3; _key2 = iprot.readI64(); _val3 = iprot.readI64(); this.received.put(_key2, _val3); } iprot.readMapEnd(); } } else { TProtocolUtil.skip(iprot, field.type); } break; case 7: // SENT if (field.type == TType.MAP) { { TMap _map4 = iprot.readMapBegin(); this.sent = new HashMap<Long, Long>(2 * _map4.size); for (int _i5 = 0; _i5 < _map4.size; ++_i5) { long _key6; long _val7; _key6 = iprot.readI64(); _val7 = iprot.readI64(); this.sent.put(_key6, _val7); } iprot.readMapEnd(); } } else { TProtocolUtil.skip(iprot, field.type); } break; case 8: // FILENAMES if (field.type == TType.LIST) { { TList _list8 = iprot.readListBegin(); this.filenames = new ArrayList<String>(_list8.size); for (int _i9 = 0; _i9 < _list8.size; ++_i9) { String _elem10; _elem10 = iprot.readString(); this.filenames.add(_elem10); } iprot.readListEnd(); } } else { TProtocolUtil.skip(iprot, field.type); } break; case 9: // TAGS if (field.type == TType.MAP) { { TMap _map11 = iprot.readMapBegin(); this.tags = new HashMap<String, String>(2 * _map11.size); for (int _i12 = 0; _i12 < _map11.size; ++_i12) { String _key13; String _val14; _key13 = iprot.readString(); _val14 = iprot.readString(); this.tags.put(_key13, _val14); } iprot.readMapEnd(); } } else { TProtocolUtil.skip(iprot, field.type); } break; default: TProtocolUtil.skip(iprot, field.type); } iprot.readFieldEnd(); } iprot.readStructEnd(); // check for required fields of primitive type, which can't be checked in the validate method validate(); }
From source file:com.linecorp.armeria.common.thrift.ThriftUtil.java
License:Apache License
/** * Converts the specified {@link FieldValueMetaData} into its corresponding Java type. *//* w w w .j a va2 s. c o m*/ public static Class<?> toJavaType(FieldValueMetaData metadata) { switch (metadata.type) { case TType.BOOL: return Boolean.class; case TType.BYTE: return Byte.class; case TType.DOUBLE: return Double.class; case TType.ENUM: return Enum.class; case TType.I16: return Short.class; case TType.I32: return Integer.class; case TType.I64: return Long.class; case TType.LIST: return List.class; case TType.MAP: return Map.class; case TType.SET: return Set.class; case TType.STRING: return String.class; case TType.STRUCT: return ((StructMetaData) metadata).structClass; case TType.VOID: return Void.class; } // Should never reach here. throw new Error(); }
From source file:com.linecorp.armeria.server.docs.MapInfo.java
License:Apache License
static MapInfo of(MapMetaData mapMetaData, Map<String, String> docStrings) { requireNonNull(mapMetaData, "mapMetaData"); assert mapMetaData.type == TType.MAP; assert !mapMetaData.isBinary(); return new MapInfo(TypeInfo.of(mapMetaData.keyMetaData, docStrings), TypeInfo.of(mapMetaData.valueMetaData, docStrings)); }