/** Converts an array of types to a list of type names. */ static List<TypeName> list(Type[] types) { return list(types, new LinkedHashMap<>()); }
/** Returns type variable named {@code name} with {@code bounds}. */ public static TypeVariableName get(String name, Type... bounds) { return TypeVariableName.of(name, TypeName.list(bounds)); }
public TypeVariableName withBounds(Type... bounds) { return withBounds(TypeName.list(bounds)); }
/** Returns a parameterized type equivalent to {@code type}. */ static ParameterizedTypeName get(ParameterizedType type, Map<Type, TypeVariableName> map) { ClassName rawType = ClassName.get((Class<?>) type.getRawType()); ParameterizedType ownerType = (type.getOwnerType() instanceof ParameterizedType) && !Modifier.isStatic(((Class<?>) type.getRawType()).getModifiers()) ? (ParameterizedType) type.getOwnerType() : null; List<TypeName> typeArguments = TypeName.list(type.getActualTypeArguments(), map); return (ownerType != null) ? get(ownerType, map).nestedClass(rawType.simpleName(), typeArguments) : new ParameterizedTypeName(null, rawType, typeArguments); } }
/** Converts an array of types to a list of type names. */ static List<TypeName> list(Type[] types) { return list(types, new LinkedHashMap<Type, TypeVariableName>()); }
/** Converts an array of types to a list of type names. */ static List<TypeName> list(Type[] types) { return list(types, new LinkedHashMap<Type, TypeVariableName>()); }
/** Returns type variable named {@code name} with {@code bounds}. */ public static TypeVariableName get(String name, Type... bounds) { return TypeVariableName.of(name, TypeName.list(bounds)); }
/** Returns type variable named {@code name} with {@code bounds}. */ public static TypeVariableName get(String name, Type... bounds) { return TypeVariableName.of(name, TypeName.list(bounds)); }
public TypeVariableName withBounds(Type... bounds) { return withBounds(TypeName.list(bounds)); }
public TypeVariableName withBounds(Type... bounds) { return withBounds(TypeName.list(bounds)); }
/** Returns a parameterized type equivalent to {@code type}. */ static ParameterizedTypeName get(ParameterizedType type, Map<Type, TypeVariableName> map) { ClassName rawType = ClassName.get((Class<?>) type.getRawType()); ParameterizedType ownerType = (type.getOwnerType() instanceof ParameterizedType) && !Modifier.isStatic(((Class<?>) type.getRawType()).getModifiers()) ? (ParameterizedType) type.getOwnerType() : null; List<TypeName> typeArguments = TypeName.list(type.getActualTypeArguments(), map); return (ownerType != null) ? get(ownerType, map).nestedClass(rawType.simpleName(), typeArguments) : new ParameterizedTypeName(null, rawType, typeArguments); } }
/** Returns a parameterized type equivalent to {@code type}. */ static ParameterizedTypeName get(ParameterizedType type, Map<Type, TypeVariableName> map) { ClassName rawType = ClassName.get((Class<?>) type.getRawType()); ParameterizedType ownerType = (type.getOwnerType() instanceof ParameterizedType) && !Modifier.isStatic(((Class<?>) type.getRawType()).getModifiers()) ? (ParameterizedType) type.getOwnerType() : null; List<TypeName> typeArguments = TypeName.list(type.getActualTypeArguments(), map); return (ownerType != null) ? get(ownerType, map).nestedClass(rawType.simpleName(), typeArguments) : new ParameterizedTypeName(null, rawType, typeArguments); } }