protected <D extends GenericDeclaration> TypeInfo getTypeVariable(TypeVariable<D> type) { TypeInfo info = super.getTypeVariable(type); if (info instanceof TypeVariableAware) ((TypeVariableAware)info).setTypeVariable(type.getName()); return info; }
/** * Get the information for a type * * @param type the type * @return the info */ @SuppressWarnings({"unchecked", "cast"}) public T get(Type type) { if (type == null) throw new IllegalArgumentException("Null type"); if (type instanceof ParameterizedType) return getParameterizedType((ParameterizedType) type); else if (type instanceof Class) return getClass((Class<?>) type); else if (type instanceof TypeVariable) // TODO Figure out why we need this cast with the Sun compiler? return (T) getTypeVariable((TypeVariable) type); else if (type instanceof GenericArrayType) return getGenericArrayType((GenericArrayType) type); else if (type instanceof WildcardType) return getWildcardType((WildcardType) type); else throw new UnsupportedOperationException("Unknown type: " + type + " class=" + type.getClass()); }