コード例 #1
0
  @Override
  public ConstructorInfo[] getDeclaredConstructors() {
    Iterable<? extends Method> implConstructors = classDef.getMethods();
    List<ConstructorInfo> result = new ArrayList<>();

    for (Method constructor : implConstructors) {
      if (isConstructor(constructor)) {
        ConstructorInfo ci = new ConstructorInfo();
        ci.parameterTypes = convertParameters(constructor.getParameters());
        ci.annotations = convertAnnotations(constructor.getAnnotations());
        ci.modifiers = constructor.getAccessFlags();

        result.add(ci);
      }
    }

    ConstructorInfo[] array = new ConstructorInfo[result.size()];
    return result.toArray(array);
  }
コード例 #2
0
  @Override
  public MethodInfo[] getDeclaredMethods() {
    Iterable<? extends Method> implMethods = classDef.getMethods();
    List<MethodInfo> result = new ArrayList<>();

    for (Method method : implMethods) {
      if (!isConstructor(method)) {
        MethodInfo mi = new MethodInfo();
        mi.parameterTypes = convertParameters(method.getParameters());
        mi.annotations = convertAnnotations(method.getAnnotations());
        mi.modifiers = method.getAccessFlags();
        mi.name = method.getName();
        mi.exceptionTypes = new ExceptionInfo[0];
        mi.returnType = DexlibAdapter.getTypeName(method.getReturnType());

        result.add(mi);
      }
    }

    MethodInfo[] array = new MethodInfo[result.size()];
    return result.toArray(array);
  }