code: public static Type[] getTypeArguments(Type type) {
          if (!(type instanceof ParameterizedType)) {
              return new Type[0];
          }
          return ((ParameterizedType) type).getActualTypeArguments();
      }
docs: Get the generic arguments for a type.
  
  @param type the type to get arguments
  @return the generic arguments, empty if type is not parameterized