@Test public void testLowerBoundedWildcardType() { final WildcardType lowerBounded = new WildcardTypeImpl(null, new Type[] { Date.class }); assertEquals(String.format("? super %s", java.sql.Date.class.getName()), TypeUtils.toString(lowerBounded)); assertEquals(String.format("? super %s", java.sql.Date.class.getName()), lowerBounded.toString()); final TypeVariable<Class<Iterable>> iterableT0 = Iterable.class.getTypeParameters()[0]; final WildcardType lowerTypeVariable = new WildcardTypeImpl(null, new Type[] { iterableT0 }); assertEquals(String.format("? super %s", iterableT0.getName()), TypeUtils.toString(lowerTypeVariable)); assertEquals(String.format("? super %s", iterableT0.getName()), lowerTypeVariable.toString()); }
public static String toString(final Type type) { Validation.notNull(type, "type"); if (type instanceof Class<?>) { return classToString((Class<?>) type); } if (type instanceof ParameterizedType) { return parameterizedTypeToString((ParameterizedType) type); } if (type instanceof WildcardType) { return wildcardTypeToString((WildcardType) type); } if (type instanceof TypeVariable<?>) { return typeVariableToString((TypeVariable<?>) type); } if (type instanceof GenericArrayType) { return genericArrayTypeToString((GenericArrayType) type); } throw ex.illegalArgumentTypeToString(type.getTypeName()); }
TypeUtils { public static String toString(final Type type) { Validation.notNull(type, "type"); if (type instanceof Class<?>) { return classToString((Class<?>) type); } if (type instanceof ParameterizedType) { return parameterizedTypeToString((ParameterizedType) type); } if (type instanceof WildcardType) { return wildcardTypeToString((WildcardType) type); } if (type instanceof TypeVariable<?>) { return typeVariableToString((TypeVariable<?>) type); } if (type instanceof GenericArrayType) { return genericArrayTypeToString((GenericArrayType) type); } throw ex.illegalArgumentTypeToString(type.getTypeName()); } }
TypeUtils { public static String toString(final Type type) { Validation.notNull(type, "type"); if (type instanceof Class<?>) { return classToString((Class<?>) type); } if (type instanceof ParameterizedType) { return parameterizedTypeToString((ParameterizedType) type); } if (type instanceof WildcardType) { return wildcardTypeToString((WildcardType) type); } if (type instanceof TypeVariable<?>) { return typeVariableToString((TypeVariable<?>) type); } if (type instanceof GenericArrayType) { return genericArrayTypeToString((GenericArrayType) type); } throw ex.illegalArgumentTypeToString(type.getTypeName()); } private  TypeUtils(); }
TypeUtils { public static String toString(final Type type) { Validation.notNull(type, "type"); if (type instanceof Class<?>) { return classToString((Class<?>) type); } if (type instanceof ParameterizedType) { return parameterizedTypeToString((ParameterizedType) type); } if (type instanceof WildcardType) { return wildcardTypeToString((WildcardType) type); } if (type instanceof TypeVariable<?>) { return typeVariableToString((TypeVariable<?>) type); } if (type instanceof GenericArrayType) { return genericArrayTypeToString((GenericArrayType) type); } throw ex.illegalArgumentTypeToString(type.getTypeName()); } private  TypeUtils(); static boolean isAssignable(final Type type, final Type toType); static Type[] normalizeUpperBounds(final Type[] bounds); static boolean equals(final Type t1, final Type t2); static String toString(final Type type); static int[] add(int[] array, int element); }
TypeUtils { public static String toString(final Type type) { Validation.notNull(type, "type"); if (type instanceof Class<?>) { return classToString((Class<?>) type); } if (type instanceof ParameterizedType) { return parameterizedTypeToString((ParameterizedType) type); } if (type instanceof WildcardType) { return wildcardTypeToString((WildcardType) type); } if (type instanceof TypeVariable<?>) { return typeVariableToString((TypeVariable<?>) type); } if (type instanceof GenericArrayType) { return genericArrayTypeToString((GenericArrayType) type); } throw ex.illegalArgumentTypeToString(type.getTypeName()); } private  TypeUtils(); static boolean isAssignable(final Type type, final Type toType); static Type[] normalizeUpperBounds(final Type[] bounds); static boolean equals(final Type t1, final Type t2); static String toString(final Type type); static int[] add(int[] array, int element);  }