コード例 #1
0
ファイル: RpcTypesProvider.java プロジェクト: geniusit/errai
  @Override
  public Collection<MetaClass> provideTypesToExpose() {
    final Set<MetaClass> types = new HashSet<MetaClass>();
    for (final MetaClass metaClass : ClassScanner.getTypesAnnotatedWith(Remote.class)) {
      for (final MetaMethod method : metaClass.getDeclaredMethods()) {
        if (!method.getReturnType().isVoid()) {
          types.add(method.getReturnType().getErased());
        }
        for (final MetaParameter parameter : method.getParameters()) {
          final MetaClass type = parameter.getType();

          types.add(type.getErased());

          final MetaParameterizedType parameterizedType = type.getParameterizedType();
          if (parameterizedType != null) {
            for (final MetaType tp : parameterizedType.getTypeParameters()) {
              if (tp instanceof MetaClass) {
                types.add(((MetaClass) tp).getErased());
              }
            }
          }
        }
      }
    }
    return types;
  }
コード例 #2
0
ファイル: GenUtil.java プロジェクト: SemenChernyy/errai
  public static MetaMethod findCaseInsensitiveMatch(
      final MetaClass retType, final MetaClass clazz, final String name, final MetaClass... parms) {
    MetaClass c = clazz;

    do {
      Outer:
      for (final MetaMethod method : c.getDeclaredMethods()) {
        if (name.equalsIgnoreCase(method.getName())) {
          if (parms.length != method.getParameters().length) continue;

          final MetaParameter[] mps = method.getParameters();
          for (int i = 0; i < parms.length; i++) {
            if (!parms[i]
                .getFullyQualifiedName()
                .equals(mps[i].getType().getFullyQualifiedName())) {
              continue Outer;
            }
          }

          if (retType != null
              && !retType
                  .getFullyQualifiedName()
                  .equals(method.getReturnType().getFullyQualifiedName())) {
            continue;
          }

          return method;
        }
      }
    } while ((c = c.getSuperClass()) != null);

    return null;
  }