Search in sources :

Example 1 with ServiceMethod

use of io.protostuff.compiler.model.ServiceMethod in project java-chassis by ServiceComb.

the class ProtoToStringGenerator method serviceToString.

private void serviceToString(Service service, StringBuilder sb) {
    appendLine(sb, "service %s {", service.getName());
    for (ServiceMethod serviceMethod : service.getMethods()) {
        commentsToString(serviceMethod.getCommentLines(), sb, 2);
        appendLine(sb, "  rpc %s (%s) returns (%s);\n", serviceMethod.getName(), serviceMethod.getArgTypeName(), serviceMethod.getReturnTypeName());
    }
    if (!service.getMethods().isEmpty()) {
        sb.setLength(sb.length() - 1);
    }
    appendLine(sb, "}");
}
Also used : ServiceMethod(io.protostuff.compiler.model.ServiceMethod)

Example 2 with ServiceMethod

use of io.protostuff.compiler.model.ServiceMethod in project java-chassis by ServiceComb.

the class ProtoMapper method getResponseMessage.

public Message getResponseMessage(String operationId) {
    Service service = proto.getServices().get(0);
    ServiceMethod serviceMethod = service.getMethod(operationId);
    return serviceMethod.getReturnType();
}
Also used : Service(io.protostuff.compiler.model.Service) ServiceMethod(io.protostuff.compiler.model.ServiceMethod)

Example 3 with ServiceMethod

use of io.protostuff.compiler.model.ServiceMethod in project java-chassis by ServiceComb.

the class ProtoMapper method getRequestMessage.

public Message getRequestMessage(String operationId) {
    Service service = proto.getServices().get(0);
    ServiceMethod serviceMethod = service.getMethod(operationId);
    if (serviceMethod == null) {
        throw new IllegalArgumentException("operation not found, operation id=" + operationId);
    }
    return serviceMethod.getArgType();
}
Also used : Service(io.protostuff.compiler.model.Service) ServiceMethod(io.protostuff.compiler.model.ServiceMethod)

Example 4 with ServiceMethod

use of io.protostuff.compiler.model.ServiceMethod in project incubator-servicecomb-java-chassis by apache.

the class ProtoToStringGenerator method serviceToString.

private void serviceToString(Service service, StringBuilder sb) {
    appendLine(sb, "service %s {", service.getName());
    for (ServiceMethod serviceMethod : service.getMethods()) {
        commentsToString(serviceMethod.getCommentLines(), sb, 2);
        appendLine(sb, "  rpc %s (%s) returns (%s);\n", serviceMethod.getName(), serviceMethod.getArgTypeName(), serviceMethod.getReturnTypeName());
    }
    if (!service.getMethods().isEmpty()) {
        sb.setLength(sb.length() - 1);
    }
    appendLine(sb, "}");
}
Also used : ServiceMethod(io.protostuff.compiler.model.ServiceMethod)

Example 5 with ServiceMethod

use of io.protostuff.compiler.model.ServiceMethod in project incubator-servicecomb-java-chassis by apache.

the class ProtoMapper method getRequestMessage.

public Message getRequestMessage(String operationId) {
    Service service = proto.getServices().get(0);
    ServiceMethod serviceMethod = service.getMethod(operationId);
    if (serviceMethod == null) {
        throw new IllegalArgumentException("operation not found, operation id=" + operationId);
    }
    return serviceMethod.getArgType();
}
Also used : Service(io.protostuff.compiler.model.Service) ServiceMethod(io.protostuff.compiler.model.ServiceMethod)

Aggregations

ServiceMethod (io.protostuff.compiler.model.ServiceMethod)6 Service (io.protostuff.compiler.model.Service)4