예제 #1
0
 public void testFalseRecursiveType_mappingOnTheSameDeclarationNotUsed() {
   Type returnType =
       genericReturnType(WithFalseRecursiveType.class, "keyShouldNotResolveToStringList");
   TypeToken<?> keyType =
       TypeToken.of(returnType).resolveType(WithFalseRecursiveType.class.getTypeParameters()[0]);
   assertEquals("java.util.List<V>", keyType.getType().toString());
 }
예제 #2
0
 public void testFalseRecursiveType_intermediaryTypeMappingDoesNotConfuseMe() {
   Type returnType =
       genericReturnType(SubtypeOfWithFalseRecursiveType.class, "revertKeyAndValueTypes");
   TypeToken<?> keyType =
       TypeToken.of(returnType).resolveType(WithFalseRecursiveType.class.getTypeParameters()[0]);
   assertEquals("java.util.List<K1>", keyType.getType().toString());
 }
 public static TypeAdapterFactory b(TypeToken<?> paramTypeToken, Object paramObject)
 {
   if (paramTypeToken.getType() == paramTypeToken.getRawType()) {}
   for (boolean bool = true;; bool = false) {
     return new er.a(paramObject, paramTypeToken, bool, null, (byte)0);
   }
 }
 public final T read(JsonReader paramJsonReader)
 {
   if (b == null) {
     return (T)a().read(paramJsonReader);
   }
   paramJsonReader = Streams.parse(paramJsonReader);
   if (paramJsonReader.isJsonNull()) {
     return null;
   }
   return (T)b.deserialize(paramJsonReader, d.getType(), c.a);
 }
 public final void write(JsonWriter paramJsonWriter, T paramT)
 {
   if (a == null)
   {
     a().write(paramJsonWriter, paramT);
     return;
   }
   if (paramT == null)
   {
     paramJsonWriter.nullValue();
     return;
   }
   Streams.write(a.serialize(paramT, d.getType(), c.b), paramJsonWriter);
 }
 public final <T> TypeAdapter<T> create(Gson paramGson, TypeToken<T> paramTypeToken)
 {
   boolean bool;
   if (a != null) {
     if ((a.equals(paramTypeToken)) || ((b) && (a.getType() == paramTypeToken.getRawType()))) {
       bool = true;
     }
   }
   while (bool)
   {
     return new er(d, e, paramGson, paramTypeToken, this, (byte)0);
     bool = false;
     continue;
     bool = c.isAssignableFrom(paramTypeToken.getRawType());
   }
   return null;
 }
예제 #7
0
 public void testFalseRecursiveType_referenceOfSubtypeDoesNotConfuseMe() {
   Type returnType = genericReturnType(WithFalseRecursiveType.class, "evenSubtypeWorks");
   TypeToken<?> keyType =
       TypeToken.of(returnType).resolveType(WithFalseRecursiveType.class.getTypeParameters()[0]);
   assertEquals("java.util.List<java.util.List<V>>", keyType.getType().toString());
 }
예제 #8
0
 public void testFalseRecursiveType_notRealRecursiveMapping() {
   Type returnType = genericReturnType(WithFalseRecursiveType.class, "shouldNotCauseInfiniteLoop");
   TypeToken<?> keyType =
       TypeToken.of(returnType).resolveType(WithFalseRecursiveType.class.getTypeParameters()[0]);
   assertEquals("java.util.List<K>", keyType.getType().toString());
 }
예제 #9
0
 public void testClassWrapper() {
   TypeToken<String> typeExpression = TypeToken.of(String.class);
   assertEquals(String.class, typeExpression.getType());
   assertEquals(String.class, typeExpression.getRawType());
 }