コード例 #1
0
ファイル: ImplCreater.java プロジェクト: gtu001/gtu-test-code
    AccessType(Method method) {
      int modifier = method.getModifiers();
      if (Modifier.isPrivate(modifier)) {
        throw new UnsupportedOperationException("method = private");
      }
      if (Modifier.isFinal(modifier)) {
        throw new UnsupportedOperationException("method = final");
      }

      this.method = method;

      accesssType = "";
      staticType = "";
      syncType = "";
      methodName = "";

      methodName = method.getName();

      if (Modifier.isProtected(modifier)) {
        accesssType = "protected";
      }
      if (Modifier.isPackage(modifier)) {
        accesssType = "";
      }
      if (Modifier.isPublic(modifier)) {
        accesssType = "public";
      }
      if (Modifier.isStatic(modifier)) {
        staticType = "static";
      }
      if (Modifier.isSynchronized(modifier)) {
        syncType = "synchronized";
      }

      returnType = createParameterName(method.getReturnType());

      Set<String> throwSet = new HashSet<String>();
      for (Class<?> ex : method.getExceptionTypes()) {
        throwSet.add(ex.getSimpleName());
      }
      this.throwSet = throwSet;

      List<Parameter> paramList = new ArrayList<Parameter>();
      for (Class<?> p : method.getParameterTypes()) {
        paramList.add(createParameterName(p));
      }
      this.paramList = paramList;
    }