code: @Nullable
      private static ParameterizedType asParameterizedType(Type type, Class<?> expectedType) {
          ParameterizedType result = null;
          if (isParameterizedType(type)) {
              ParameterizedType parameterizedType = (ParameterizedType) type;
              if (expectedType.isAssignableFrom((Class<?>) parameterizedType.getRawType())) {
                  result = parameterizedType;
              }
          }
          return result;
      }
docs: Returns the given type casted to {@code ParameterizedType} if and only
  if it is a {@code ParameterizedType} and its raw type is assignable from
  the given expected type.
  
  @param type         the type whose expect parameterized must be tested.
  @param expectedType expected parameterized type.
  @return the expected parameterized type or {@code null}.