Search in sources :

Example 1 with Service

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

the class ProtoToStringGenerator method protoToString.

public String protoToString() {
    StringBuilder sb = new StringBuilder();
    appendLine(sb, "syntax = \"%s\";", proto.getSyntax());
    for (Import importValue : proto.getImports()) {
        appendLine(sb, "import \"%s\";", importValue.getValue());
    }
    appendLine(sb, "package %s;\n", proto.getPackage().getValue());
    for (Message message : proto.getMessages()) {
        messageToString(message, sb);
    }
    for (Enum enumValue : proto.getEnums()) {
        enumToString(enumValue, sb);
    }
    for (Service service : proto.getServices()) {
        serviceToString(service, sb);
    }
    return sb.toString();
}
Also used : Enum(io.protostuff.compiler.model.Enum) Import(io.protostuff.compiler.model.Import) Message(io.protostuff.compiler.model.Message) Service(io.protostuff.compiler.model.Service)

Example 2 with Service

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

the class ProtoToStringGenerator method protoToString.

public String protoToString() {
    StringBuilder sb = new StringBuilder();
    appendLine(sb, "syntax = \"%s\";", proto.getSyntax());
    for (Import importValue : proto.getImports()) {
        appendLine(sb, "import \"%s\";", importValue.getValue());
    }
    appendLine(sb, "package %s;\n", proto.getPackage().getValue());
    for (Message message : proto.getMessages()) {
        messageToString(message, sb);
    }
    for (Enum enumValue : proto.getEnums()) {
        enumToString(enumValue, sb);
    }
    for (Service service : proto.getServices()) {
        serviceToString(service, sb);
    }
    return sb.toString();
}
Also used : Enum(io.protostuff.compiler.model.Enum) Import(io.protostuff.compiler.model.Import) Message(io.protostuff.compiler.model.Message) Service(io.protostuff.compiler.model.Service)

Example 3 with Service

use of io.protostuff.compiler.model.Service 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 4 with Service

use of io.protostuff.compiler.model.Service 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 5 with Service

use of io.protostuff.compiler.model.Service 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

Service (io.protostuff.compiler.model.Service)6 ServiceMethod (io.protostuff.compiler.model.ServiceMethod)4 Enum (io.protostuff.compiler.model.Enum)2 Import (io.protostuff.compiler.model.Import)2 Message (io.protostuff.compiler.model.Message)2