public static <K, V> ThriftType map(ThriftType keyType, ThriftType valueType) { checkNotNull(keyType, "keyType is null"); checkNotNull(valueType, "valueType is null"); @SuppressWarnings("serial") Type javaType = new TypeToken<Map<K, V>>() {}.where( new TypeParameter<K>() {}, (TypeToken<K>) TypeToken.of(keyType.getJavaType())) .where(new TypeParameter<V>() {}, (TypeToken<V>) TypeToken.of(valueType.getJavaType())) .getType(); return new ThriftType(ThriftProtocolType.MAP, javaType, keyType, valueType); }
public static <E> ThriftType list(ThriftType valueType) { checkNotNull(valueType, "valueType is null"); @SuppressWarnings("serial") Type javaType = new TypeToken<List<E>>() {}.where( new TypeParameter<E>() {}, (TypeToken<E>) TypeToken.of(valueType.getJavaType())) .getType(); return new ThriftType(ThriftProtocolType.LIST, javaType, null, valueType); }
public ThriftType(ThriftType uncoercedType, Type javaType) { this.javaType = javaType; this.uncoercedType = uncoercedType; this.protocolType = uncoercedType.getProtocolType(); keyType = null; valueType = null; structMetadata = null; enumMetadata = null; }