public static <K, V> ThriftType map(ThriftType keyType, ThriftType valueType) { checkNotNull(keyType, "keyType is null"); checkNotNull(valueType, "valueType is null"); return map(new DefaultThriftTypeReference(keyType), new DefaultThriftTypeReference(valueType)); }
@Test public void testCollectionThriftTypes() throws Exception { testRoundTripSerialize(set(STRING), ImmutableSet.of("some string", "another string")); testRoundTripSerialize(list(STRING), ImmutableList.of("some string", "another string")); testRoundTripSerialize(map(STRING, STRING), ImmutableMap.of("1", "one", "2", "two")); }
Type mapKeyType = getMapKeyType(javaType); Type mapValueType = getMapValueType(javaType); return map(getThriftType(mapKeyType), getThriftType(mapValueType));
Type mapKeyType = getMapKeyType(javaType); Type mapValueType = getMapValueType(javaType); return map(getMapKeyThriftTypeReference(mapKeyType), getMapValueThriftTypeReference(mapValueType));
@Test public void testCoercedCollection() throws Exception { testRoundTripSerialize(set(I32.coerceTo(Integer.class)), ImmutableSet.of(1, 2, 3)); testRoundTripSerialize(list(I32.coerceTo(Integer.class)), ImmutableList.of(4, 5, 6)); testRoundTripSerialize(map(I32.coerceTo(Integer.class), I32.coerceTo(Integer.class)), ImmutableMap.of(1, 2, 2, 4, 3, 9)); }