Code example for ParameterizedType

Methods: getRawType

            assert t!=null;
            if (t instanceof Class)
                return onClass((Class)t,param);
            if (t instanceof ParameterizedType)
                return onParameterizdType( (ParameterizedType)t,param);
            if(t instanceof GenericArrayType)
                return onGenericArray((GenericArrayType)t,param);
            if(t instanceof WildcardType)
                return onWildcard((WildcardType)t,param);
            if(t instanceof TypeVariable)
                return onVariable((TypeVariable)t,param);
            // covered all the cases 
            assert false; 
            throw new IllegalArgumentException();
        protected abstract T onClass(Class c, P param);
        protected abstract T onParameterizdType(ParameterizedType p, P param);
        protected abstract T onGenericArray(GenericArrayType g, P param);
        protected abstract T onVariable(TypeVariable v, P param);
        protected abstract T onWildcard(WildcardType w, P param);
     * Implements the logic for {@link #erasure(Type)}. 
    private static final TypeVisitor<Class,Void> eraser = new TypeVisitor<Class,Void>() {
        public Class onClass(Class c,Void _) { 
            return c; 
        public Class onParameterizdType(ParameterizedType p,Void _) { 
            // TODO: why getRawType returns Type? not Class? 
            return visit(p.getRawType(),null); 
        public Class onGenericArray(GenericArrayType g,Void _) { 
            return Array.newInstance(