Code example for ParameterizedType

Methods: getRawType

0
      ParameterizedType parameterizedType = (ParameterizedType) type;
 
      // I'm not exactly sure why getRawType() returns Type instead of Class. 
      // Neal isn't either but suspects some pathological case related 
      // to nested classes exists. 
      Type rawType = parameterizedType.getRawType();
      if (rawType instanceof Class<?>) {
        return (Class<?>) rawType;
      } 
      throw buildUnexpectedTypeError(rawType, Class.class);
    } else if (type instanceof GenericArrayType) {
      GenericArrayType genericArrayType = (GenericArrayType) type;
 
      // TODO(jleitch): This is not the most efficient way to handle generic 
      // arrays, but is there another way to extract the array class in a 
      // non-hacky way (i.e. using String value class names- "[L...")? 
      Object rawArrayType = Array.newInstance(
          getRawType(genericArrayType.getGenericComponentType()), 0);
      return rawArrayType.getClass();
    } else { 
      throw buildUnexpectedTypeError(