@Override
 public <T> void extract(ModelSchemaExtractionContext<T> extractionContext) {
   Type type = extractionContext.getType().getType();
   if (!(type instanceof Class)) {
     return;
   }
   Class<?> contractType = (Class<?>) type;
   if (!contractType.isInterface()) {
     return;
   }
   if (contractType.getGenericInterfaces().length != 1) {
     return;
   }
   Type superType = contractType.getGenericInterfaces()[0];
   if (!(superType instanceof ParameterizedType)) {
     return;
   }
   ParameterizedType parameterizedSuperType = (ParameterizedType) superType;
   if (!parameterizedSuperType.getRawType().equals(ModelMap.class)) {
     return;
   }
   ModelType<?> elementType = ModelType.of(parameterizedSuperType.getActualTypeArguments()[0]);
   Class<?> proxyImpl = generator.generate(ModelMapGroovyDecorator.Managed.class, contractType);
   extractionContext.found(
       new SpecializedMapSchema<T>(extractionContext.getType(), elementType, proxyImpl));
 }
Example #2
1
  /**
   * Returns the generic supertype for {@code supertype}. For example, given a class {@code
   * IntegerSet}, the result for when supertype is {@code Set.class} is {@code Set<Integer>} and the
   * result when the supertype is {@code Collection.class} is {@code Collection<Integer>}.
   */
  static Type getGenericSupertype(Type context, Class<?> rawType, Class<?> toResolve) {
    if (toResolve == rawType) {
      return context;
    }

    // we skip searching through interfaces if unknown is an interface
    if (toResolve.isInterface()) {
      Class<?>[] interfaces = rawType.getInterfaces();
      for (int i = 0, length = interfaces.length; i < length; i++) {
        if (interfaces[i] == toResolve) {
          return rawType.getGenericInterfaces()[i];
        } else if (toResolve.isAssignableFrom(interfaces[i])) {
          return getGenericSupertype(rawType.getGenericInterfaces()[i], interfaces[i], toResolve);
        }
      }
    }

    // check our supertypes
    if (!rawType.isInterface()) {
      while (rawType != Object.class) {
        Class<?> rawSupertype = rawType.getSuperclass();
        if (rawSupertype == toResolve) {
          return rawType.getGenericSuperclass();
        } else if (toResolve.isAssignableFrom(rawSupertype)) {
          return getGenericSupertype(rawType.getGenericSuperclass(), rawSupertype, toResolve);
        }
        rawType = rawSupertype;
      }
    }

    // we can't resolve this further
    return toResolve;
  }
 private static Type getClosestParentType(Class paramClass1, Class paramClass2) {
   Object localObject1;
   int j;
   Object localObject2;
   Class localClass;
   if (paramClass2.isInterface()) {
     Type[] arrayOfType = paramClass1.getGenericInterfaces();
     localObject1 = null;
     int i = arrayOfType.length;
     j = 0;
     if (j < i) {
       localObject2 = arrayOfType[j];
       if ((localObject2 instanceof ParameterizedType)) {
         localClass = getRawType((ParameterizedType) localObject2);
         label52:
         if ((!isAssignable(localClass, paramClass2))
             || (!isAssignable((Type) localObject1, localClass))) break label133;
       }
     }
   }
   while (true) {
     j++;
     localObject1 = localObject2;
     break;
     if ((localObject2 instanceof Class)) {
       localClass = (Class) localObject2;
       break label52;
     }
     throw new IllegalStateException("Unexpected generic interface type found: " + localObject2);
     if (localObject1 != null) return localObject1;
     return paramClass1.getGenericSuperclass();
     label133:
     localObject2 = localObject1;
   }
 }
Example #4
1
 private void makeInterfaceTypes(CompileUnit cu, ClassNode classNode, Class clazz) {
   Type[] interfaceTypes = clazz.getGenericInterfaces();
   if (interfaceTypes.length == 0) {
     classNode.setInterfaces(ClassNode.EMPTY_ARRAY);
   } else {
     ClassNode[] ret = new ClassNode[interfaceTypes.length];
     for (int i = 0; i < interfaceTypes.length; i++) {
       Type type = interfaceTypes[i];
       while (!(type instanceof Class)) {
         ParameterizedType pt = (ParameterizedType) type;
         Type t2 = pt.getRawType();
         if (t2 == type) {
           throw new GroovyBugError(
               "Cannot transform generic signature of "
                   + clazz
                   + " with generic interface "
                   + interfaceTypes[i]
                   + " to a class.");
         }
         type = t2;
       }
       ret[i] = makeClassNode(cu, interfaceTypes[i], (Class) type);
     }
     classNode.setInterfaces(ret);
   }
 }
Example #5
1
  /**
   * Determines the key type for a Map.
   *
   * @param type The parametrized type.
   * @param path The path to the type, used in exception message.
   * @return The key type.
   */
  public static Type[] mapTypes(Type type, String path) {
    if (type instanceof Class) {
      Class c = (Class) type;
      type = c.getGenericSuperclass();
      if (!(isGenericMap(type))) {
        Type[] types = c.getGenericInterfaces();
        if (types != null && types.length > 0) {
          for (Type t : types) {
            if (isGenericMap(t)) {
              type = t;
              break;
            }
          }
        }
      }
    }

    if (type instanceof ParameterizedType) {
      ParameterizedType parameterizedType = (ParameterizedType) type;
      Class<?> rawType = (Class<?>) parameterizedType.getRawType();
      if (Map.class.isAssignableFrom(rawType)) {
        return parameterizedType.getActualTypeArguments();
      }
    }

    throw new CollectionExpressionException(
        "The method or member ["
            + path
            + "] returns a simple Map. Unable to determine the "
            + "types of the Map. Please make this method or member generic so that the correct type can be determined.");
  }
Example #6
1
 private Class<?> getEventType(EventSubscriber<?> subscriber) {
   Class<?> eventType = null;
   Class<?> clazz = subscriber.getClass();
   while (clazz != null && eventType == null) {
     for (Type type : clazz.getGenericInterfaces()) {
       if (type instanceof ParameterizedType) {
         final ParameterizedType parameterizedType = (ParameterizedType) type;
         final Type rawType = parameterizedType.getRawType();
         if (EventSubscriber.class == rawType) {
           final Type[] typeArguments = parameterizedType.getActualTypeArguments();
           if (typeArguments.length == 1) {
             if (typeArguments[0] instanceof Class) {
               eventType = (Class) typeArguments[0];
             }
           }
         }
       }
     }
     clazz = clazz.getSuperclass();
   }
   if (eventType == null) {
     throw new IllegalArgumentException(
         String.format("Unable determine type of events processed by %s", subscriber));
   }
   return eventType;
 }
  /**
   * Gets the super class genric type.
   *
   * @param clazz the clazz
   * @param index the index
   * @return the super class genric type
   */
  @SuppressWarnings("rawtypes")
  public static Class getSuperClassGenricType(final Class clazz, final int index) {
    Type genType = clazz.getGenericSuperclass();
    if (!(genType instanceof ParameterizedType)) {
      genType = clazz.getGenericInterfaces()[index];
    }
    if (!(genType instanceof ParameterizedType)) {
      logger.warn(clazz.getSimpleName() + "'s superclass not ParameterizedType");
      return Object.class;
    }

    Type[] params = ((ParameterizedType) genType).getActualTypeArguments();

    if (index >= params.length || index < 0) {
      logger.warn(
          "Index: "
              + index
              + ", Size of "
              + clazz.getSimpleName()
              + "'s Parameterized Type: "
              + params.length);
      return Object.class;
    }
    if (!(params[index] instanceof Class)) {
      logger.warn(
          clazz.getSimpleName() + " not set the actual class on superclass generic parameter");
      return Object.class;
    }

    return (Class) params[index];
  }
 protected static HierarchicType _findSuperInterfaceChain(Type currentType, Class<?> target) {
   HierarchicType current = new HierarchicType(currentType);
   Class<?> raw = current.getRawClass();
   if (raw == target) {
     return current;
   }
   // Otherwise, keep on going down the rat hole; first implemented interaces
   Type[] parents = raw.getGenericInterfaces();
   // as long as there are superclasses
   // and unless we have already seen the type (<T extends X<T>>)
   if (parents != null) {
     for (Type parent : parents) {
       HierarchicType sup = _findSuperInterfaceChain(parent, target);
       if (sup != null) {
         sup.setSubType(current);
         current.setSuperType(sup);
         return current;
       }
     }
   }
   // and then super-class if any
   Type parent = raw.getGenericSuperclass();
   if (parent != null) {
     HierarchicType sup = _findSuperInterfaceChain(parent, target);
     if (sup != null) {
       sup.setSubType(current);
       current.setSuperType(sup);
       return current;
     }
   }
   return null;
 }
  @SuppressWarnings("unchecked")
  static Class<? extends Event<?>> getEventClass(Class<?> handlerClass) {

    for (Class<?> i : handlerClass.getInterfaces()) {
      if (EventHandler.class.equals(i)) {
        for (Type t : handlerClass.getGenericInterfaces()) {
          if (t instanceof ParameterizedType) {
            ParameterizedType pt = (ParameterizedType) t;
            if (EventHandler.class.equals(pt.getRawType())) {

              return (Class<? extends Event<?>>) pt.getActualTypeArguments()[0];
            }
          }
        }
      } else if (EventHandler.class.isAssignableFrom(i)) {
        return getEventClass((Class<? extends EventHandler<?>>) i);
      }
    }

    if (EventHandler.class.isAssignableFrom(handlerClass.getSuperclass())) {
      return getEventClass((Class<?>) handlerClass.getSuperclass());
    }

    return null;
  }
 private List<String> GetImplements(Class<?> cls) {
   List<String> list = new ArrayList<>();
   for (Type interf : cls.getGenericInterfaces()) {
     list.add(interf.getTypeName());
   }
   return list;
 }
 private void readActualTypeParametersOnDeclaringClass() {
   registerTypeParametersOn(clazz.getTypeParameters());
   registerTypeVariablesOn(clazz.getGenericSuperclass());
   for (Type genericInterface : clazz.getGenericInterfaces()) {
     registerTypeVariablesOn(genericInterface);
   }
 }
  private Object searchForBaseClass(
      Class<?> clazz, AutoBindSingleton annotation, Set<Object> usedSet) {
    if (clazz == null) {
      return null;
    }

    if (clazz.equals(annotation.value())) {
      return clazz;
    }

    if (!usedSet.add(clazz)) {
      return null;
    }

    for (Type type : clazz.getGenericInterfaces()) {
      if (MoreTypes.getRawType(type).equals(annotation.value())) {
        return type;
      }
    }

    if (clazz.getGenericSuperclass() != null) {
      if (MoreTypes.getRawType(clazz.getGenericSuperclass()).equals(annotation.value())) {
        return clazz.getGenericSuperclass();
      }
    }

    for (Class<?> interfaceClass : clazz.getInterfaces()) {
      Object foundBindingClass = searchForBaseClass(interfaceClass, annotation, usedSet);
      if (foundBindingClass != null) {
        return foundBindingClass;
      }
    }

    return searchForBaseClass(clazz.getSuperclass(), annotation, usedSet);
  }
Example #13
0
 /**
  * 获取c的泛型类型
  *
  * @param c
  * @param superclass: 指定是从父类还是父接口中取, true=父类, false=接口
  * @param index: 如果是从接口中找泛型, 则指定第几个接口
  * @return
  */
 public static Type getGenericType(Class<?> c, boolean superclass, int index) {
   Type type = superclass ? c.getGenericSuperclass() : c.getGenericInterfaces()[index];
   if (type instanceof ParameterizedType) {
     return getGenericType((ParameterizedType) type);
   } else {
     return Object.class;
   }
 }
  /**
   * Get the first parameterized type
   *
   * @param leafClass is the class to start at
   * @return the parameterized type or null
   */
  public static ParameterizedType getFirstParameterizedType(Class<?> leafClass) {
    for (Type interfaceType : leafClass.getGenericInterfaces()) {
      if (interfaceType instanceof ParameterizedType) {
        return (ParameterizedType) interfaceType;
      }
    }

    return null;
  }
Example #15
0
 /**
  * 获取c的泛型类型, 如果c有接口则从第一个接口中取,否则从父类中取
  *
  * @param c
  * @return
  */
 public static Type getGenericType(Class<?> c) {
   Type[] ts = c.getGenericInterfaces();
   Type type = ts.length > 0 ? ts[0] : c.getGenericSuperclass();
   if (type instanceof ParameterizedType) {
     return getGenericType((ParameterizedType) type);
   } else {
     return Object.class;
   }
 }
  /**
   * Dig up the inheritance tree to find the actual class at which the event handler is defined
   *
   * @param leafClass is the leafclass to start digging up from
   * @return a parameterized type instance that defines the eventhandler.
   */
  public static ParameterizedType getEventHandlerClass(Class<?> leafClass) {

    for (Type interfaceType : leafClass.getGenericInterfaces()) {
      if (isEventHandlerInterface(interfaceType)) {
        return (ParameterizedType) interfaceType;
      }
    }

    return null;
  }
Example #17
0
  private static DeclaringClassInterfacePair getClass(Class concrete, Class iface, Class c) {
    Type[] gis = c.getGenericInterfaces();
    DeclaringClassInterfacePair p = getType(concrete, iface, c, gis);
    if (p != null) return p;

    c = c.getSuperclass();
    if (c == null || c == Object.class) return null;

    return getClass(concrete, iface, c);
  }
Example #18
0
 public static Set<String> analyze(Class<?> enumClass) {
   print("----- Analyzing " + enumClass + " -----");
   print("Interfaces:");
   for (Type t : enumClass.getGenericInterfaces()) print(t);
   print("Base: " + enumClass.getSuperclass());
   print("Methods: ");
   Set<String> methods = new TreeSet<String>();
   for (Method m : enumClass.getMethods()) methods.add(m.getName());
   print(methods);
   return methods;
 }
Example #19
0
 private void addGenericInterfaces(Class<?> clazz) {
   Type[] genericInterfaces = clazz.getGenericInterfaces();
   for (Type genericInterface : genericInterfaces) {
     if (genericInterface instanceof ParameterizedType) {
       ParameterizedType pt = (ParameterizedType) genericInterface;
       Class<?> interf = (Class<?>) pt.getRawType();
       addGenericInterfaces(interf);
       doApplyArguments(interf, pt.getActualTypeArguments());
     }
   }
 }
  private void listen(java.lang.reflect.Type type, Class<?> clazz) throws InvalidPluginException {
    while (type != null) {
      Class<?> rawType;
      if (type instanceof ParameterizedType) {
        rawType = (Class<?>) ((ParameterizedType) type).getRawType();
      } else if (type instanceof Class) {
        rawType = (Class<?>) type;
      } else {
        return;
      }

      if (rawType.getAnnotation(ExtensionPoint.class) != null) {
        TypeLiteral<?> tl = TypeLiteral.get(type);
        if (env.hasDynamicItem(tl)) {
          sysSingletons.add(clazz);
          sysListen.put(tl, clazz);
          httpGen.listen(tl, clazz);
          sshGen.listen(tl, clazz);
        } else if (env.hasDynamicSet(tl)) {
          sysSingletons.add(clazz);
          sysListen.put(tl, clazz);
          httpGen.listen(tl, clazz);
          sshGen.listen(tl, clazz);
        } else if (env.hasDynamicMap(tl)) {
          if (clazz.getAnnotation(Export.class) == null) {
            throw new InvalidPluginException(
                String.format(
                    "Class %s requires @Export(\"name\") annotation for %s",
                    clazz.getName(), rawType.getName()));
          }
          sysSingletons.add(clazz);
          sysListen.put(tl, clazz);
          httpGen.listen(tl, clazz);
          sshGen.listen(tl, clazz);
        } else {
          throw new InvalidPluginException(
              String.format(
                  "Cannot register %s, server does not accept %s",
                  clazz.getName(), rawType.getName()));
        }
        return;
      }

      java.lang.reflect.Type[] interfaces = rawType.getGenericInterfaces();
      if (interfaces != null) {
        for (java.lang.reflect.Type i : interfaces) {
          listen(i, clazz);
        }
      }

      type = rawType.getGenericSuperclass();
    }
  }
Example #21
0
  private Class<?> getAdapterType(Object adapter) {
    final Class<?> klazz = extractRawTypeIfPossible(adapter.getClass());
    final Type[] genericInterfaces = klazz.getGenericInterfaces();
    final ParameterizedType type = (ParameterizedType) genericInterfaces[0];
    final Type actualType = type.getActualTypeArguments()[0];

    if (actualType instanceof ParameterizedType) {
      return (Class<?>) ((ParameterizedType) actualType).getRawType();
    } else {
      return (Class<?>) actualType;
    }
  }
Example #22
0
  /** Resolves <code>TypeVariable</code> with given implementation class. */
  public static Type resolveVariable(TypeVariable variable, final Class implClass) {
    final Class rawType = getRawType(implClass, null);

    int index = ArraysUtil.indexOf(rawType.getTypeParameters(), variable);
    if (index >= 0) {
      return variable;
    }

    final Class[] interfaces = rawType.getInterfaces();
    final Type[] genericInterfaces = rawType.getGenericInterfaces();

    for (int i = 0; i <= interfaces.length; i++) {
      Class rawInterface;

      if (i < interfaces.length) {
        rawInterface = interfaces[i];
      } else {
        rawInterface = rawType.getSuperclass();
        if (rawInterface == null) {
          continue;
        }
      }

      final Type resolved = resolveVariable(variable, rawInterface);
      if (resolved instanceof Class || resolved instanceof ParameterizedType) {
        return resolved;
      }

      if (resolved instanceof TypeVariable) {
        final TypeVariable typeVariable = (TypeVariable) resolved;
        index = ArraysUtil.indexOf(rawInterface.getTypeParameters(), typeVariable);

        if (index < 0) {
          throw new IllegalArgumentException("Invalid type variable:" + typeVariable);
        }

        final Type type =
            i < genericInterfaces.length ? genericInterfaces[i] : rawType.getGenericSuperclass();

        if (type instanceof Class) {
          return Object.class;
        }

        if (type instanceof ParameterizedType) {
          return ((ParameterizedType) type).getActualTypeArguments()[index];
        }

        throw new IllegalArgumentException("Unsupported type: " + type);
      }
    }
    return null;
  }
  /** Private recursive helper function to actually do the type-safe checking of assignability. */
  private static boolean isAssignableFrom(
      Type from, ParameterizedType to, Map<String, Type> typeVarMap) {

    if (from == null) {
      return false;
    }

    if (to.equals(from)) {
      return true;
    }

    // First figure out the class and any type information.
    Class<?> clazz = getRawType(from);
    ParameterizedType ptype = null;
    if (from instanceof ParameterizedType) {
      ptype = (ParameterizedType) from;
    }

    // Load up parameterized variable info if it was parameterized.
    if (ptype != null) {
      Type[] tArgs = ptype.getActualTypeArguments();
      TypeVariable<?>[] tParams = clazz.getTypeParameters();
      for (int i = 0; i < tArgs.length; i++) {
        Type arg = tArgs[i];
        TypeVariable<?> var = tParams[i];
        while (arg instanceof TypeVariable) {
          TypeVariable<?> v = (TypeVariable<?>) arg;
          arg = typeVarMap.get(v.getName());
        }
        typeVarMap.put(var.getName(), arg);
      }

      // check if they are equivalent under our current mapping.
      if (typeEquals(ptype, to, typeVarMap)) {
        return true;
      }
    }

    for (Type itype : clazz.getGenericInterfaces()) {
      if (isAssignableFrom(itype, to, new HashMap<String, Type>(typeVarMap))) {
        return true;
      }
    }

    // Interfaces didn't work, try the superclass.
    Type sType = clazz.getGenericSuperclass();
    if (isAssignableFrom(sType, to, new HashMap<String, Type>(typeVarMap))) {
      return true;
    }

    return false;
  }
  private static Type[] getResolvedInterfaces(Type type) {
    Contracts.assertNotNull(type, "type");

    Class<?> rawType = getErasedReferenceType(type);
    Type[] interfaces = rawType.getGenericInterfaces();
    Type[] resolvedInterfaces = new Type[interfaces.length];

    for (int i = 0; i < interfaces.length; i++) {
      resolvedInterfaces[i] = resolveTypeVariables(interfaces[i], type);
    }

    return resolvedInterfaces;
  }
Example #25
0
 private void makeInterfaceTypes(CompileUnit cu, ClassNode classNode, Class clazz) {
   Type[] interfaceTypes = clazz.getGenericInterfaces();
   if (interfaceTypes.length == 0) {
     classNode.setInterfaces(ClassNode.EMPTY_ARRAY);
   } else {
     Class[] interfaceClasses = clazz.getInterfaces();
     ClassNode[] ret = new ClassNode[interfaceTypes.length];
     for (int i = 0; i < interfaceTypes.length; i++) {
       ret[i] = makeClassNode(cu, interfaceTypes[i], interfaceClasses[i]);
     }
     classNode.setInterfaces(ret);
   }
 }
Example #26
0
 /**
  * Returns the arguments of the provided generic class or interface.
  *
  * @param type the class to search.
  * @param args the class arguments.
  * @param clazz the generic class or interface of interest.
  * @return the arguments of the generic class or interface, or <code>null</code> if not found.
  */
 protected static Type[] getTypeArguments(Class<?> type, Type[] args, Class<?> clazz) {
   if (type == clazz) {
     return args;
   }
   TypeVariable[] params = type.getTypeParameters();
   for (Type iface : type.getGenericInterfaces()) {
     Type[] result = getTypeArguments(iface, params, args, clazz);
     if (result != null) {
       return result;
     }
   }
   return getTypeArguments(type.getGenericSuperclass(), params, args, clazz);
 }
  /**
   * Extract the real Type from the passed class. For example <tt>public Class MyClass implements
   * FilterClass&lt;A, B&gt;, SomeOtherClass&lt;C&gt;</tt> will return <tt>FilterClass&lt;A, B&gt;,
   * SomeOtherClass&lt;C&gt;</tt>.
   *
   * @param clazz the class to extract from
   * @param filterClass the class of the generic type we're looking for
   * @return the real Type from the interfaces of the passed class, filtered by the passed filter
   *     class
   * @since 4.0M1
   */
  public static Type getGenericClassType(Class clazz, Class filterClass) {
    for (Type type : clazz.getGenericInterfaces()) {
      if (type == filterClass) {
        return type;
      } else if (type instanceof ParameterizedType) {
        ParameterizedType pType = (ParameterizedType) type;
        if (filterClass.isAssignableFrom((Class) pType.getRawType())) {
          return type;
        }
      }
    }

    return null;
  }
 private static Type resolveTypeForClassAndHierarchy(
     Map<Type, Type> resolvedTypes, Class<?> clazz) {
   Type returnedType = resolveTypes(resolvedTypes, clazz.getGenericSuperclass());
   if (returnedType != null) {
     return returnedType;
   }
   for (Type genericInterface : clazz.getGenericInterfaces()) {
     returnedType = resolveTypes(resolvedTypes, genericInterface);
     if (returnedType != null) {
       return returnedType;
     }
   }
   return null;
 }
Example #29
0
  public static void main(String... args) {
    try {
      Class<?> c = Class.forName(args[0]);
      out.format("Class:%n  %s%n%n", c.getCanonicalName());
      out.format("Modifiers:%n  %s%n%n", Modifier.toString(c.getModifiers()));

      out.format("Type Parameters:%n");
      TypeVariable<?>[] tv = c.getTypeParameters();
      if (tv.length != 0) {
        out.format("  ");
        for (TypeVariable<?> t : tv) out.format("%s ", t.getName());
        out.format("%n%n");
      } else {
        out.format("  -- No Type Parameters --%n%n");
      }

      out.format("Implemented Interfaces:%n");
      Type[] intfs = c.getGenericInterfaces();
      if (intfs.length != 0) {
        for (Type intf : intfs) out.format("  %s%n", intf.toString());
        out.format("%n");
      } else {
        out.format("  -- No Implemented Interfaces --%n%n");
      }

      out.format("Inheritance Path:%n");
      List<Class<?>> l = new ArrayList<Class<?>>();
      printAncestor(c, l);
      if (l.size() != 0) {
        for (Class<?> cl : l) out.format("  %s%n", cl.getCanonicalName());
        out.format("%n");
      } else {
        out.format("  -- No Super Classes --%n%n");
      }

      out.format("Annotations:%n");
      Annotation[] ann = c.getAnnotations();
      if (ann.length != 0) {
        for (Annotation a : ann) out.format("  %s%n", a.toString());
        out.format("%n");
      } else {
        out.format("  -- No Annotations --%n%n");
      }

      // production code should handle this exception more gracefully
    } catch (ClassNotFoundException x) {
      x.printStackTrace();
    }
  }
  /**
   * Get the actual class of the <U> parameter.
   *
   * @return The class of the root element or widget generated from UiBinder.
   */
  private Class<?> getRootElementClass() {
    for (Type type : proxiedClass.getGenericInterfaces()) {

      if (type instanceof ParameterizedType) {
        ParameterizedType pType = (ParameterizedType) type;

        return (Class<?>) pType.getActualTypeArguments()[0];
      }
    }

    throw new GwtTestUiBinderException(
        "The UiBinder subinterface '"
            + proxiedClass.getName()
            + "' is not parameterized. Please add its generic types.");
  }