Ejemplo n.º 1
0
  @Override
  public void emitService(Service service, Set<String> importedTypes) throws IOException {
    importedTypes.addAll(getImports(service));
    writer.emitImports(importedTypes);
    writer.emitEmptyLine();

    if (!service.getDocumentation().isEmpty()) {
      writer.emitJavadoc(service.getDocumentation());
    }
    writer.beginType(service.getName(), "interface", EnumSet.of(Modifier.PUBLIC));
    for (Service.Method method : service.getMethods()) {
      String requestType = method.getRequestType();
      int index = requestType.lastIndexOf('.');
      if (index != -1) {
        requestType = requestType.substring(index + 1);
      }

      if (!method.getDocumentation().isEmpty()) {
        writer.emitJavadoc(method.getDocumentation());
      }
      emitAnnotation(service, method);
      writer.beginMethod(
          method.getResponseType(),
          getMethodName(method),
          EnumSet.noneOf(Modifier.class),
          Arrays.asList(getRequestType(requestType), getRequestName(requestType)),
          getThrows());
      writer.endMethod();
    }
    writer.endType();
  }
Ejemplo n.º 2
0
 String getMethodName(Service.Method method) {
   return lowerCaseInitialLetter(method.getName());
 }