コード例 #1
0
ファイル: TitleIT.java プロジェクト: JanGe/jsonschema2pojo
  @Test
  public void descriptionAppearsInGetterJavadoc() throws IOException {

    JavaMethod javaMethod = classWithTitle.getMethodBySignature("getTitle", new Type[] {});
    String javaDocComment = javaMethod.getComment();

    assertThat(javaDocComment, containsString("A title for this property"));
  }
コード例 #2
0
ファイル: OnosSwaggerMojo.java プロジェクト: wangqilei/onos
  private void processRestMethod(
      JavaMethod javaMethod,
      String method,
      Map<String, ObjectNode> pathMap,
      String resourcePath,
      ArrayNode tagArray,
      ObjectNode definitions) {
    String fullPath = resourcePath, consumes = "", produces = "", comment = javaMethod.getComment();
    DocletTag tag = javaMethod.getTagByName("rsModel");
    for (JavaAnnotation annotation : javaMethod.getAnnotations()) {
      String name = annotation.getType().getName();
      if (name.equals(PATH)) {
        fullPath = resourcePath + "/" + getPath(annotation);
        fullPath = fullPath.replaceFirst("^//", "/");
      }
      if (name.equals(CONSUMES)) {
        consumes = getIOType(annotation);
      }
      if (name.equals(PRODUCES)) {
        produces = getIOType(annotation);
      }
    }
    ObjectNode methodNode = mapper.createObjectNode();
    methodNode.set("tags", tagArray);

    addSummaryDescriptions(methodNode, comment);
    addJsonSchemaDefinition(definitions, tag);
    addJsonSchemaDefinition(definitions, tag);

    processParameters(javaMethod, methodNode, method, tag);

    processConsumesProduces(methodNode, "consumes", consumes);
    processConsumesProduces(methodNode, "produces", produces);
    if (tag == null
        || ((method.toLowerCase().equals("post") || method.toLowerCase().equals("put"))
            && !(tag.getParameters().size() > 1))) {
      addResponses(methodNode, tag, false);
    } else {
      addResponses(methodNode, tag, true);
    }

    ObjectNode operations = pathMap.get(fullPath);
    if (operations == null) {
      operations = mapper.createObjectNode();
      operations.set(method, methodNode);
      pathMap.put(fullPath, operations);
    } else {
      operations.set(method, methodNode);
    }
  }
コード例 #3
0
ファイル: OnosSwaggerMojo.java プロジェクト: rvhub/onos
  private void processRestMethod(
      JavaMethod javaMethod,
      String method,
      Map<String, ObjectNode> pathMap,
      String resourcePath,
      ArrayNode tagArray) {
    String fullPath = resourcePath, consumes = "", produces = "", comment = javaMethod.getComment();
    for (JavaAnnotation annotation : javaMethod.getAnnotations()) {
      String name = annotation.getType().getName();
      if (name.equals(PATH)) {
        fullPath = resourcePath + "/" + getPath(annotation);
        fullPath = fullPath.replaceFirst("^//", "/");
      }
      if (name.equals(CONSUMES)) {
        consumes = getIOType(annotation);
      }
      if (name.equals(PRODUCES)) {
        produces = getIOType(annotation);
      }
    }
    ObjectNode methodNode = mapper.createObjectNode();
    methodNode.set("tags", tagArray);

    addSummaryDescriptions(methodNode, comment);
    processParameters(javaMethod, methodNode);

    processConsumesProduces(methodNode, "consumes", consumes);
    processConsumesProduces(methodNode, "produces", produces);

    addResponses(methodNode);

    ObjectNode operations = pathMap.get(fullPath);
    if (operations == null) {
      operations = mapper.createObjectNode();
      operations.set(method, methodNode);
      pathMap.put(fullPath, operations);
    } else {
      operations.set(method, methodNode);
    }
  }
コード例 #4
0
ファイル: DocletDocumenter.java プロジェクト: djalexd/TGIRest
 private void buildDescription(MethodDocument document, JavaMethod javaMethod) {
   document.setDescription(javaMethod.getComment());
 }