code: public static Type getTypeArgument(Type type) {
          if (!(type instanceof ParameterizedType)) {
              return null;
          }
          return ((ParameterizedType) type).getActualTypeArguments()[0];
      }
docs: Get the generic argument, or the first if the type has more than one.
  
  @param type the type to get arguments
  @return the generic argument, null if type is not parameterized