INNER CODE UNIT · Java

parameterizedType

scalecube/scalecube-services · services-api/src/main/java/io/scalecube/services/Reflect.java:143

  public static Type parameterizedType(Object object) {
    if (object != null) {
      Type type = object.getClass().getGenericSuperclass();
      if (type instanceof ParameterizedType pt) {
        return isAsyncContainer(type) ? pt.getActualTypeArguments()[0] : pt;
      }
    }
    return Object.class;
  }

  /**
   * Returns the parameterized of the request type of a given object.
   *
   * @return the parameterized type
   */
  public static Type parameterizedRequestType(Method method) {
    if (method != null && method.getGenericParameterTypes().length > 0) {
      Type type = method.getGenericParameterTypes()[0];

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…