Search in sources :

Example 1 with ServiceMessages

use of com.google.api.codegen.ServiceMessages in project toolkit by googleapis.

the class StaticLangApiMethodTransformer method setCommonFields.

private void setCommonFields(MethodContext context, StaticLangApiMethodView.Builder methodViewBuilder) {
    MethodModel method = context.getMethodModel();
    SurfaceNamer namer = context.getNamer();
    InterfaceConfig interfaceConfig = context.getInterfaceConfig();
    String requestTypeName = method.getAndSaveRequestTypeName(context.getTypeTable(), context.getNamer());
    methodViewBuilder.serviceRequestTypeName(requestTypeName);
    methodViewBuilder.serviceRequestTypeConstructor(namer.getTypeConstructor(requestTypeName));
    methodViewBuilder.serviceConstructorName(namer.getApiWrapperClassConstructorName(context.getInterfaceConfig()));
    setServiceResponseTypeName(context, methodViewBuilder);
    methodViewBuilder.apiClassName(namer.getApiWrapperClassName(interfaceConfig));
    methodViewBuilder.apiVariableName(namer.getApiWrapperVariableName(interfaceConfig));
    methodViewBuilder.stubName(namer.getStubName(context.getTargetInterface()));
    methodViewBuilder.settingsGetterName(namer.getSettingsFunctionName(method));
    methodViewBuilder.callableName(context.getNamer().getCallableName(method));
    methodViewBuilder.modifyMethodName(namer.getModifyMethodName(context));
    methodViewBuilder.grpcStreamingType(context.getMethodConfig().getGrpcStreamingType());
    methodViewBuilder.visibility(namer.getVisiblityKeyword(context.getMethodConfig().getVisibility()));
    methodViewBuilder.releaseLevelAnnotation(namer.getReleaseAnnotation(context.getMethodConfig().getReleaseLevel()));
    ServiceMessages messages = new ServiceMessages();
    if (context.getMethodConfig().isLongRunningOperation()) {
        methodViewBuilder.hasReturnValue(!context.getMethodConfig().getLongRunningConfig().getReturnType().isEmptyType());
    } else {
        methodViewBuilder.hasReturnValue(!method.isOutputTypeEmpty());
    }
    methodViewBuilder.headerRequestParams(headerRequestParamTransformer.generateHeaderRequestParams(context));
}
Also used : MethodModel(com.google.api.codegen.config.MethodModel) InterfaceConfig(com.google.api.codegen.config.InterfaceConfig) ServiceMessages(com.google.api.codegen.ServiceMessages)

Aggregations

ServiceMessages (com.google.api.codegen.ServiceMessages)1 InterfaceConfig (com.google.api.codegen.config.InterfaceConfig)1 MethodModel (com.google.api.codegen.config.MethodModel)1