Skip to content

Instantly share code, notes, and snippets.

@act262
Created March 20, 2017 04:21
Show Gist options
  • Save act262/5ee2c4e06a7649cf0ec7130feb70ec6b to your computer and use it in GitHub Desktop.
Save act262/5ee2c4e06a7649cf0ec7130feb70ec6b to your computer and use it in GitHub Desktop.
Gson Type
public class TypeFactory {
public static Type $List(Type type) {
return $Gson$Types.newParameterizedTypeWithOwner(null, List.class, type);
}
public static Type $Set(Type type) {
return $Gson$Types.newParameterizedTypeWithOwner(null, Set.class, type);
}
public static Type $HashMap(Type type, Type type2) {
return $Gson$Types.newParameterizedTypeWithOwner(null, HashMap.class, type, type2);
}
public static Type $Map(Type type, Type type2) {
return $Gson$Types.newParameterizedTypeWithOwner(null, Map.class, type, type2);
}
public static Type $Parameterized(Type ownerType, Type rawType, Type... typeArguments) {
return $Gson$Types.newParameterizedTypeWithOwner(ownerType, rawType, typeArguments);
}
public static Type $Array(Type type) {
return $Gson$Types.arrayOf(type);
}
public static Type $SubtypeOf(Type type) {
return $Gson$Types.subtypeOf(type);
}
public static Type $SupertypeOf(Type type) {
return $Gson$Types.supertypeOf(type);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment