Search in sources :

Example 1 with DEFAULT

use of javax.lang.model.element.Modifier.DEFAULT in project servicetalk by apple.

the class Generator method newServiceInterfaceSpec.

/**
 * Adds the service interface, either async or blocking, which extends all of the service RPC interfaces
 *
 * @param state The generator state
 * @param blocking If true then add the interface for blocking service otherwise add async service interface
 * @return The generated service interface
 */
private TypeSpec newServiceInterfaceSpec(final State state, final boolean blocking) {
    final ClassName serviceClass = blocking ? state.blockingServiceClass : state.serviceClass;
    final String name = serviceClass.simpleName();
    final TypeSpec.Builder interfaceSpecBuilder = interfaceBuilder(name).addModifiers(PUBLIC).addSuperinterface(ParameterizedTypeName.get(GrpcBindableService, state.serviceClass));
    state.serviceRpcInterfaces.stream().filter(e -> e.blocking == blocking).map(e -> e.className).forEach(interfaceSpecBuilder::addSuperinterface);
    // Add the default bindService method.
    MethodSpec.Builder b = methodBuilder(bind + Service);
    if (printJavaDocs) {
        b.addJavadoc("Makes a {@link $T} bound to this instance implementing {@link $T}", state.serviceFactoryClass, serviceClass);
    }
    interfaceSpecBuilder.addMethod(b.addAnnotation(Override.class).addModifiers(PUBLIC).addModifiers(DEFAULT).returns(state.serviceFactoryClass).addStatement("return new $T(this)", state.serviceFactoryClass).build());
    // Add the default methodDescriptors method.
    interfaceSpecBuilder.addMethod(methodBuilder(methodDescriptors).addAnnotation(Override.class).addModifiers(PUBLIC).addModifiers(DEFAULT).returns(GrpcMethodDescriptorCollection).addStatement("return $L", blocking ? BLOCKING_METHOD_DESCRIPTORS : ASYNC_METHOD_DESCRIPTORS).build());
    return interfaceSpecBuilder.build();
}
Also used : Arrays(io.servicetalk.grpc.protoc.Types.Arrays) Words.bufferDecoderGroup(io.servicetalk.grpc.protoc.Words.bufferDecoderGroup) Modifier(javax.lang.model.element.Modifier) RequestStreamingRoute(io.servicetalk.grpc.protoc.Types.RequestStreamingRoute) BlockingIterable(io.servicetalk.grpc.protoc.Types.BlockingIterable) AllGrpcRoutes(io.servicetalk.grpc.protoc.Types.AllGrpcRoutes) COMMENT_PRE_TAG(io.servicetalk.grpc.protoc.Words.COMMENT_PRE_TAG) GrpcExecutionStrategy(io.servicetalk.grpc.protoc.Types.GrpcExecutionStrategy) GrpcMethodDescriptor(io.servicetalk.grpc.protoc.Types.GrpcMethodDescriptor) Rpc(io.servicetalk.grpc.protoc.Words.Rpc) Words.factory(io.servicetalk.grpc.protoc.Words.factory) Words.request(io.servicetalk.grpc.protoc.Words.request) GrpcPayloadWriter(io.servicetalk.grpc.protoc.Types.GrpcPayloadWriter) FINAL(javax.lang.model.element.Modifier.FINAL) MethodDescriptorProto(com.google.protobuf.DescriptorProtos.MethodDescriptorProto) Duration(java.time.Duration) Map(java.util.Map) Words.isSupportedMessageCodingsEmpty(io.servicetalk.grpc.protoc.Words.isSupportedMessageCodingsEmpty) GrpcSupportedCodings(io.servicetalk.grpc.protoc.Types.GrpcSupportedCodings) Route(io.servicetalk.grpc.protoc.Types.Route) BlockingRequestStreamingRoute(io.servicetalk.grpc.protoc.Types.BlockingRequestStreamingRoute) DefaultGrpcClientMetadata(io.servicetalk.grpc.protoc.Types.DefaultGrpcClientMetadata) Words.initSerializationProvider(io.servicetalk.grpc.protoc.Words.initSerializationProvider) EnumSet(java.util.EnumSet) ResponseStreamingRoute(io.servicetalk.grpc.protoc.Types.ResponseStreamingRoute) Call(io.servicetalk.grpc.protoc.Words.Call) StringUtils.escapeJavaDoc(io.servicetalk.grpc.protoc.StringUtils.escapeJavaDoc) ContentCodec(io.servicetalk.grpc.protoc.Types.ContentCodec) JAVADOC_THROWS(io.servicetalk.grpc.protoc.Words.JAVADOC_THROWS) Single(io.servicetalk.grpc.protoc.Types.Single) Words.routes(io.servicetalk.grpc.protoc.Words.routes) GrpcMethodDescriptorCollection(io.servicetalk.grpc.protoc.Types.GrpcMethodDescriptorCollection) StringUtils.sanitizeIdentifier(io.servicetalk.grpc.protoc.StringUtils.sanitizeIdentifier) GrpcMethodDescriptors(io.servicetalk.grpc.protoc.Types.GrpcMethodDescriptors) Collectors.joining(java.util.stream.Collectors.joining) Words.strategy(io.servicetalk.grpc.protoc.Words.strategy) BlockingStreamingRoute(io.servicetalk.grpc.protoc.Types.BlockingStreamingRoute) BLOCKING_METHOD_DESCRIPTORS(io.servicetalk.grpc.protoc.Words.BLOCKING_METHOD_DESCRIPTORS) Words.executionContext(io.servicetalk.grpc.protoc.Words.executionContext) Words.metadata(io.servicetalk.grpc.protoc.Words.metadata) EnumSet.noneOf(java.util.EnumSet.noneOf) BlockingGrpcClient(io.servicetalk.grpc.protoc.Types.BlockingGrpcClient) JAVADOC_PARAM(io.servicetalk.grpc.protoc.Words.JAVADOC_PARAM) DEFAULT(javax.lang.model.element.Modifier.DEFAULT) RouteExecutionStrategyFactory(io.servicetalk.grpc.protoc.Types.RouteExecutionStrategyFactory) GrpcClientMetadata(io.servicetalk.grpc.protoc.Types.GrpcClientMetadata) GrpcService(io.servicetalk.grpc.protoc.Types.GrpcService) BlockingResponseStreamingClientCall(io.servicetalk.grpc.protoc.Types.BlockingResponseStreamingClientCall) Words.service(io.servicetalk.grpc.protoc.Words.service) ArrayList(java.util.ArrayList) Words.addService(io.servicetalk.grpc.protoc.Words.addService) Stream.concat(java.util.stream.Stream.concat) Completable(io.servicetalk.grpc.protoc.Types.Completable) JAVADOC_DEPRECATED(io.servicetalk.grpc.protoc.Words.JAVADOC_DEPRECATED) CodeBlock(com.squareup.javapoet.CodeBlock) Nullable(javax.annotation.Nullable) TypeSpec.interfaceBuilder(com.squareup.javapoet.TypeSpec.interfaceBuilder) NOOP_MAP(io.servicetalk.grpc.protoc.NoopServiceCommentsMap.NOOP_MAP) RPC_PATH(io.servicetalk.grpc.protoc.Words.RPC_PATH) BLOCKING(io.servicetalk.grpc.protoc.Generator.NewRpcMethodFlag.BLOCKING) Collections(io.servicetalk.grpc.protoc.Types.Collections) Objects(io.servicetalk.grpc.protoc.Types.Objects) COMMENT_POST_TAG(io.servicetalk.grpc.protoc.Words.COMMENT_POST_TAG) INTERFACE(io.servicetalk.grpc.protoc.Generator.NewRpcMethodFlag.INTERFACE) Words.closeAsync(io.servicetalk.grpc.protoc.Words.closeAsync) PROTOBUF(io.servicetalk.grpc.protoc.Words.PROTOBUF) MethodSpec(com.squareup.javapoet.MethodSpec) Words.methodDescriptor(io.servicetalk.grpc.protoc.Words.methodDescriptor) GrpcRouteExecutionStrategyFactory(io.servicetalk.grpc.protoc.Types.GrpcRouteExecutionStrategyFactory) Words.registerRoutes(io.servicetalk.grpc.protoc.Words.registerRoutes) ParameterizedTypeName(com.squareup.javapoet.ParameterizedTypeName) INSTANCE(io.servicetalk.grpc.protoc.Words.INSTANCE) TypeSpec(com.squareup.javapoet.TypeSpec) Words.client(io.servicetalk.grpc.protoc.Words.client) BlockingGrpcService(io.servicetalk.grpc.protoc.Types.BlockingGrpcService) BufferDecoderGroup(io.servicetalk.grpc.protoc.Types.BufferDecoderGroup) Words.bufferEncoders(io.servicetalk.grpc.protoc.Words.bufferEncoders) Words.closeable(io.servicetalk.grpc.protoc.Words.closeable) PROTECTED(javax.lang.model.element.Modifier.PROTECTED) Service(io.servicetalk.grpc.protoc.Words.Service) GrpcClientCallFactory(io.servicetalk.grpc.protoc.Types.GrpcClientCallFactory) BlockingClientCall(io.servicetalk.grpc.protoc.Types.BlockingClientCall) Factory(io.servicetalk.grpc.protoc.Words.Factory) MethodSpec.methodBuilder(com.squareup.javapoet.MethodSpec.methodBuilder) Words.addBlockingService(io.servicetalk.grpc.protoc.Words.addBlockingService) BOOLEAN(com.squareup.javapoet.TypeName.BOOLEAN) Words.timeout(io.servicetalk.grpc.protoc.Words.timeout) GrpcRoutes(io.servicetalk.grpc.protoc.Types.GrpcRoutes) Words.requestEncoding(io.servicetalk.grpc.protoc.Words.requestEncoding) ServiceDescriptorProto(com.google.protobuf.DescriptorProtos.ServiceDescriptorProto) BiFunction(java.util.function.BiFunction) ClassName(com.squareup.javapoet.ClassName) CLIENT(io.servicetalk.grpc.protoc.Generator.NewRpcMethodFlag.CLIENT) EmptyBufferDecoderGroup(io.servicetalk.grpc.protoc.Types.EmptyBufferDecoderGroup) JAVADOC_CONSTRUCTOR_DEFAULT_STATEMENT(io.servicetalk.grpc.protoc.Words.JAVADOC_CONSTRUCTOR_DEFAULT_STATEMENT) ResponseStreamingClientCall(io.servicetalk.grpc.protoc.Types.ResponseStreamingClientCall) Identity(io.servicetalk.grpc.protoc.Types.Identity) Metadata(io.servicetalk.grpc.protoc.Words.Metadata) BlockingRequestStreamingClientCall(io.servicetalk.grpc.protoc.Types.BlockingRequestStreamingClientCall) AsyncCloseable(io.servicetalk.grpc.protoc.Types.AsyncCloseable) GrpcStatusException(io.servicetalk.grpc.protoc.Types.GrpcStatusException) GrpcBindableService(io.servicetalk.grpc.protoc.Types.GrpcBindableService) To(io.servicetalk.grpc.protoc.Words.To) GrpcExecutionContext(io.servicetalk.grpc.protoc.Types.GrpcExecutionContext) JAVADOC_RETURN(io.servicetalk.grpc.protoc.Words.JAVADOC_RETURN) SourceCodeInfo(com.google.protobuf.DescriptorProtos.SourceCodeInfo) ABSTRACT(javax.lang.model.element.Modifier.ABSTRACT) BufferEncoderList(io.servicetalk.grpc.protoc.Types.BufferEncoderList) RouteExecutionStrategy(io.servicetalk.grpc.protoc.Types.RouteExecutionStrategy) Words.builder(io.servicetalk.grpc.protoc.Words.builder) MethodSpec.constructorBuilder(com.squareup.javapoet.MethodSpec.constructorBuilder) Blocking(io.servicetalk.grpc.protoc.Words.Blocking) GrpcServiceContext(io.servicetalk.grpc.protoc.Types.GrpcServiceContext) Words.ctx(io.servicetalk.grpc.protoc.Words.ctx) ProtobufSerializerFactory(io.servicetalk.grpc.protoc.Types.ProtobufSerializerFactory) List(java.util.List) ClientCall(io.servicetalk.grpc.protoc.Types.ClientCall) Words.supportedMessageCodings(io.servicetalk.grpc.protoc.Words.supportedMessageCodings) Words.closeGracefully(io.servicetalk.grpc.protoc.Words.closeGracefully) GrpcServiceFactory(io.servicetalk.grpc.protoc.Types.GrpcServiceFactory) StreamingRoute(io.servicetalk.grpc.protoc.Types.StreamingRoute) Words.closeAsyncGracefully(io.servicetalk.grpc.protoc.Words.closeAsyncGracefully) BlockingRoute(io.servicetalk.grpc.protoc.Types.BlockingRoute) Words.onClose(io.servicetalk.grpc.protoc.Words.onClose) ProtoBufSerializationProviderBuilder(io.servicetalk.grpc.protoc.Types.ProtoBufSerializationProviderBuilder) System.lineSeparator(java.lang.System.lineSeparator) FieldSpec(com.squareup.javapoet.FieldSpec) Words.bind(io.servicetalk.grpc.protoc.Words.bind) PROTO_CONTENT_TYPE(io.servicetalk.grpc.protoc.Words.PROTO_CONTENT_TYPE) Builder(io.servicetalk.grpc.protoc.Words.Builder) Words.responseWriter(io.servicetalk.grpc.protoc.Words.responseWriter) TypeSpec.classBuilder(com.squareup.javapoet.TypeSpec.classBuilder) BlockingStreamingClientCall(io.servicetalk.grpc.protoc.Types.BlockingStreamingClientCall) Default(io.servicetalk.grpc.protoc.Words.Default) GrpcClient(io.servicetalk.grpc.protoc.Types.GrpcClient) GrpcClientFactory(io.servicetalk.grpc.protoc.Types.GrpcClientFactory) Client(io.servicetalk.grpc.protoc.Words.Client) PRIVATE(javax.lang.model.element.Modifier.PRIVATE) Words.methodDescriptors(io.servicetalk.grpc.protoc.Words.methodDescriptors) PUBLIC(javax.lang.model.element.Modifier.PUBLIC) StreamingClientCall(io.servicetalk.grpc.protoc.Types.StreamingClientCall) GrpcSerializationProvider(io.servicetalk.grpc.protoc.Types.GrpcSerializationProvider) Words.rpc(io.servicetalk.grpc.protoc.Words.rpc) STATIC(javax.lang.model.element.Modifier.STATIC) Words.close(io.servicetalk.grpc.protoc.Words.close) Publisher(io.servicetalk.grpc.protoc.Types.Publisher) BlockingResponseStreamingRoute(io.servicetalk.grpc.protoc.Types.BlockingResponseStreamingRoute) RequestStreamingClientCall(io.servicetalk.grpc.protoc.Types.RequestStreamingClientCall) Words.strategyFactory(io.servicetalk.grpc.protoc.Words.strategyFactory) ASYNC_METHOD_DESCRIPTORS(io.servicetalk.grpc.protoc.Words.ASYNC_METHOD_DESCRIPTORS) MethodSpec(com.squareup.javapoet.MethodSpec) ClassName(com.squareup.javapoet.ClassName) TypeSpec(com.squareup.javapoet.TypeSpec)

Example 2 with DEFAULT

use of javax.lang.model.element.Modifier.DEFAULT in project servicetalk by apple.

the class Generator method addClientInterfaces.

private TypeSpec.Builder addClientInterfaces(final State state, final TypeSpec.Builder serviceClassBuilder) {
    final TypeSpec.Builder clientSpecBuilder = interfaceBuilder(state.clientClass).addModifiers(PUBLIC).addSuperinterface(ParameterizedTypeName.get(GrpcClient, state.blockingClientClass));
    final TypeSpec.Builder blockingClientSpecBuilder = interfaceBuilder(state.blockingClientClass).addModifiers(PUBLIC).addSuperinterface(ParameterizedTypeName.get(BlockingGrpcClient, state.clientClass));
    for (int i = 0; i < state.clientMetaDatas.size(); ++i) {
        final int methodIndex = i;
        ClientMetaData clientMetaData = state.clientMetaDatas.get(i);
        clientSpecBuilder.addMethod(newRpcMethodSpec(clientMetaData.methodProto, EnumSet.of(INTERFACE, CLIENT), printJavaDocs, (__, b) -> {
            b.addModifiers(ABSTRACT);
            if (printJavaDocs) {
                extractJavaDocComments(state, methodIndex, b);
            }
            return b;
        })).addMethod(newRpcMethodSpec(clientMetaData.methodProto, EnumSet.of(INTERFACE, CLIENT), printJavaDocs, (methodName, b) -> {
            ClassName inClass = messageTypesMap.get(clientMetaData.methodProto.getInputType());
            b.addModifiers(ABSTRACT).addParameter(clientMetaData.className, metadata).addAnnotation(Deprecated.class);
            if (printJavaDocs) {
                extractJavaDocComments(state, methodIndex, b);
                b.addJavadoc(JAVADOC_DEPRECATED + "Use {@link #$L($T,$T)}." + lineSeparator(), methodName, GrpcClientMetadata, clientMetaData.methodProto.getClientStreaming() ? Publisher : inClass).addJavadoc(JAVADOC_PARAM + metadata + " the metadata associated with this client call." + lineSeparator());
            }
            return b;
        })).addMethod(newRpcMethodSpec(clientMetaData.methodProto, EnumSet.of(INTERFACE, CLIENT), printJavaDocs, (methodName, b) -> {
            b.addModifiers(DEFAULT).addParameter(GrpcClientMetadata, metadata);
            if (printJavaDocs) {
                extractJavaDocComments(state, methodIndex, b);
                b.addJavadoc(JAVADOC_PARAM + metadata + " the metadata associated with this client call." + lineSeparator());
            }
            return b.addStatement("return $L(new $T($L), $L)", methodName, clientMetaData.className, metadata, request);
        }));
        blockingClientSpecBuilder.addMethod(newRpcMethodSpec(clientMetaData.methodProto, EnumSet.of(BLOCKING, INTERFACE, CLIENT), printJavaDocs, (__, b) -> {
            b.addModifiers(ABSTRACT);
            if (printJavaDocs) {
                extractJavaDocComments(state, methodIndex, b);
            }
            return b;
        })).addMethod(newRpcMethodSpec(clientMetaData.methodProto, EnumSet.of(BLOCKING, INTERFACE, CLIENT), printJavaDocs, (methodName, b) -> {
            ClassName inClass = messageTypesMap.get(clientMetaData.methodProto.getInputType());
            b.addModifiers(ABSTRACT).addParameter(clientMetaData.className, metadata).addAnnotation(Deprecated.class);
            if (printJavaDocs) {
                extractJavaDocComments(state, methodIndex, b);
                b.addJavadoc(JAVADOC_DEPRECATED + "Use {@link #$L($T,$T)}." + lineSeparator(), methodName, GrpcClientMetadata, clientMetaData.methodProto.getClientStreaming() ? Types.Iterable : inClass).addJavadoc(JAVADOC_PARAM + metadata + " the metadata associated with this client call." + lineSeparator());
            }
            return b;
        })).addMethod(newRpcMethodSpec(clientMetaData.methodProto, EnumSet.of(BLOCKING, INTERFACE, CLIENT), printJavaDocs, (methodName, b) -> {
            b.addModifiers(DEFAULT).addParameter(GrpcClientMetadata, metadata);
            if (printJavaDocs) {
                extractJavaDocComments(state, methodIndex, b);
                b.addJavadoc(JAVADOC_PARAM + metadata + " the metadata associated with this client call." + lineSeparator());
            }
            return b.addStatement("return $L(new $T($L), $L)", methodName, clientMetaData.className, metadata, request);
        }));
    }
    serviceClassBuilder.addType(clientSpecBuilder.build()).addType(blockingClientSpecBuilder.build());
    return serviceClassBuilder;
}
Also used : Arrays(io.servicetalk.grpc.protoc.Types.Arrays) Words.bufferDecoderGroup(io.servicetalk.grpc.protoc.Words.bufferDecoderGroup) Modifier(javax.lang.model.element.Modifier) RequestStreamingRoute(io.servicetalk.grpc.protoc.Types.RequestStreamingRoute) BlockingIterable(io.servicetalk.grpc.protoc.Types.BlockingIterable) AllGrpcRoutes(io.servicetalk.grpc.protoc.Types.AllGrpcRoutes) COMMENT_PRE_TAG(io.servicetalk.grpc.protoc.Words.COMMENT_PRE_TAG) GrpcExecutionStrategy(io.servicetalk.grpc.protoc.Types.GrpcExecutionStrategy) GrpcMethodDescriptor(io.servicetalk.grpc.protoc.Types.GrpcMethodDescriptor) Rpc(io.servicetalk.grpc.protoc.Words.Rpc) Words.factory(io.servicetalk.grpc.protoc.Words.factory) Words.request(io.servicetalk.grpc.protoc.Words.request) GrpcPayloadWriter(io.servicetalk.grpc.protoc.Types.GrpcPayloadWriter) FINAL(javax.lang.model.element.Modifier.FINAL) MethodDescriptorProto(com.google.protobuf.DescriptorProtos.MethodDescriptorProto) Duration(java.time.Duration) Map(java.util.Map) Words.isSupportedMessageCodingsEmpty(io.servicetalk.grpc.protoc.Words.isSupportedMessageCodingsEmpty) GrpcSupportedCodings(io.servicetalk.grpc.protoc.Types.GrpcSupportedCodings) Route(io.servicetalk.grpc.protoc.Types.Route) BlockingRequestStreamingRoute(io.servicetalk.grpc.protoc.Types.BlockingRequestStreamingRoute) DefaultGrpcClientMetadata(io.servicetalk.grpc.protoc.Types.DefaultGrpcClientMetadata) Words.initSerializationProvider(io.servicetalk.grpc.protoc.Words.initSerializationProvider) EnumSet(java.util.EnumSet) ResponseStreamingRoute(io.servicetalk.grpc.protoc.Types.ResponseStreamingRoute) Call(io.servicetalk.grpc.protoc.Words.Call) StringUtils.escapeJavaDoc(io.servicetalk.grpc.protoc.StringUtils.escapeJavaDoc) ContentCodec(io.servicetalk.grpc.protoc.Types.ContentCodec) JAVADOC_THROWS(io.servicetalk.grpc.protoc.Words.JAVADOC_THROWS) Single(io.servicetalk.grpc.protoc.Types.Single) Words.routes(io.servicetalk.grpc.protoc.Words.routes) GrpcMethodDescriptorCollection(io.servicetalk.grpc.protoc.Types.GrpcMethodDescriptorCollection) StringUtils.sanitizeIdentifier(io.servicetalk.grpc.protoc.StringUtils.sanitizeIdentifier) GrpcMethodDescriptors(io.servicetalk.grpc.protoc.Types.GrpcMethodDescriptors) Collectors.joining(java.util.stream.Collectors.joining) Words.strategy(io.servicetalk.grpc.protoc.Words.strategy) BlockingStreamingRoute(io.servicetalk.grpc.protoc.Types.BlockingStreamingRoute) BLOCKING_METHOD_DESCRIPTORS(io.servicetalk.grpc.protoc.Words.BLOCKING_METHOD_DESCRIPTORS) Words.executionContext(io.servicetalk.grpc.protoc.Words.executionContext) Words.metadata(io.servicetalk.grpc.protoc.Words.metadata) EnumSet.noneOf(java.util.EnumSet.noneOf) BlockingGrpcClient(io.servicetalk.grpc.protoc.Types.BlockingGrpcClient) JAVADOC_PARAM(io.servicetalk.grpc.protoc.Words.JAVADOC_PARAM) DEFAULT(javax.lang.model.element.Modifier.DEFAULT) RouteExecutionStrategyFactory(io.servicetalk.grpc.protoc.Types.RouteExecutionStrategyFactory) GrpcClientMetadata(io.servicetalk.grpc.protoc.Types.GrpcClientMetadata) GrpcService(io.servicetalk.grpc.protoc.Types.GrpcService) BlockingResponseStreamingClientCall(io.servicetalk.grpc.protoc.Types.BlockingResponseStreamingClientCall) Words.service(io.servicetalk.grpc.protoc.Words.service) ArrayList(java.util.ArrayList) Words.addService(io.servicetalk.grpc.protoc.Words.addService) Stream.concat(java.util.stream.Stream.concat) Completable(io.servicetalk.grpc.protoc.Types.Completable) JAVADOC_DEPRECATED(io.servicetalk.grpc.protoc.Words.JAVADOC_DEPRECATED) CodeBlock(com.squareup.javapoet.CodeBlock) Nullable(javax.annotation.Nullable) TypeSpec.interfaceBuilder(com.squareup.javapoet.TypeSpec.interfaceBuilder) NOOP_MAP(io.servicetalk.grpc.protoc.NoopServiceCommentsMap.NOOP_MAP) RPC_PATH(io.servicetalk.grpc.protoc.Words.RPC_PATH) BLOCKING(io.servicetalk.grpc.protoc.Generator.NewRpcMethodFlag.BLOCKING) Collections(io.servicetalk.grpc.protoc.Types.Collections) Objects(io.servicetalk.grpc.protoc.Types.Objects) COMMENT_POST_TAG(io.servicetalk.grpc.protoc.Words.COMMENT_POST_TAG) INTERFACE(io.servicetalk.grpc.protoc.Generator.NewRpcMethodFlag.INTERFACE) Words.closeAsync(io.servicetalk.grpc.protoc.Words.closeAsync) PROTOBUF(io.servicetalk.grpc.protoc.Words.PROTOBUF) MethodSpec(com.squareup.javapoet.MethodSpec) Words.methodDescriptor(io.servicetalk.grpc.protoc.Words.methodDescriptor) GrpcRouteExecutionStrategyFactory(io.servicetalk.grpc.protoc.Types.GrpcRouteExecutionStrategyFactory) Words.registerRoutes(io.servicetalk.grpc.protoc.Words.registerRoutes) ParameterizedTypeName(com.squareup.javapoet.ParameterizedTypeName) INSTANCE(io.servicetalk.grpc.protoc.Words.INSTANCE) TypeSpec(com.squareup.javapoet.TypeSpec) Words.client(io.servicetalk.grpc.protoc.Words.client) BlockingGrpcService(io.servicetalk.grpc.protoc.Types.BlockingGrpcService) BufferDecoderGroup(io.servicetalk.grpc.protoc.Types.BufferDecoderGroup) Words.bufferEncoders(io.servicetalk.grpc.protoc.Words.bufferEncoders) Words.closeable(io.servicetalk.grpc.protoc.Words.closeable) PROTECTED(javax.lang.model.element.Modifier.PROTECTED) Service(io.servicetalk.grpc.protoc.Words.Service) GrpcClientCallFactory(io.servicetalk.grpc.protoc.Types.GrpcClientCallFactory) BlockingClientCall(io.servicetalk.grpc.protoc.Types.BlockingClientCall) Factory(io.servicetalk.grpc.protoc.Words.Factory) MethodSpec.methodBuilder(com.squareup.javapoet.MethodSpec.methodBuilder) Words.addBlockingService(io.servicetalk.grpc.protoc.Words.addBlockingService) BOOLEAN(com.squareup.javapoet.TypeName.BOOLEAN) Words.timeout(io.servicetalk.grpc.protoc.Words.timeout) GrpcRoutes(io.servicetalk.grpc.protoc.Types.GrpcRoutes) Words.requestEncoding(io.servicetalk.grpc.protoc.Words.requestEncoding) ServiceDescriptorProto(com.google.protobuf.DescriptorProtos.ServiceDescriptorProto) BiFunction(java.util.function.BiFunction) ClassName(com.squareup.javapoet.ClassName) CLIENT(io.servicetalk.grpc.protoc.Generator.NewRpcMethodFlag.CLIENT) EmptyBufferDecoderGroup(io.servicetalk.grpc.protoc.Types.EmptyBufferDecoderGroup) JAVADOC_CONSTRUCTOR_DEFAULT_STATEMENT(io.servicetalk.grpc.protoc.Words.JAVADOC_CONSTRUCTOR_DEFAULT_STATEMENT) ResponseStreamingClientCall(io.servicetalk.grpc.protoc.Types.ResponseStreamingClientCall) Identity(io.servicetalk.grpc.protoc.Types.Identity) Metadata(io.servicetalk.grpc.protoc.Words.Metadata) BlockingRequestStreamingClientCall(io.servicetalk.grpc.protoc.Types.BlockingRequestStreamingClientCall) AsyncCloseable(io.servicetalk.grpc.protoc.Types.AsyncCloseable) GrpcStatusException(io.servicetalk.grpc.protoc.Types.GrpcStatusException) GrpcBindableService(io.servicetalk.grpc.protoc.Types.GrpcBindableService) To(io.servicetalk.grpc.protoc.Words.To) GrpcExecutionContext(io.servicetalk.grpc.protoc.Types.GrpcExecutionContext) JAVADOC_RETURN(io.servicetalk.grpc.protoc.Words.JAVADOC_RETURN) SourceCodeInfo(com.google.protobuf.DescriptorProtos.SourceCodeInfo) ABSTRACT(javax.lang.model.element.Modifier.ABSTRACT) BufferEncoderList(io.servicetalk.grpc.protoc.Types.BufferEncoderList) RouteExecutionStrategy(io.servicetalk.grpc.protoc.Types.RouteExecutionStrategy) Words.builder(io.servicetalk.grpc.protoc.Words.builder) MethodSpec.constructorBuilder(com.squareup.javapoet.MethodSpec.constructorBuilder) Blocking(io.servicetalk.grpc.protoc.Words.Blocking) GrpcServiceContext(io.servicetalk.grpc.protoc.Types.GrpcServiceContext) Words.ctx(io.servicetalk.grpc.protoc.Words.ctx) ProtobufSerializerFactory(io.servicetalk.grpc.protoc.Types.ProtobufSerializerFactory) List(java.util.List) ClientCall(io.servicetalk.grpc.protoc.Types.ClientCall) Words.supportedMessageCodings(io.servicetalk.grpc.protoc.Words.supportedMessageCodings) Words.closeGracefully(io.servicetalk.grpc.protoc.Words.closeGracefully) GrpcServiceFactory(io.servicetalk.grpc.protoc.Types.GrpcServiceFactory) StreamingRoute(io.servicetalk.grpc.protoc.Types.StreamingRoute) Words.closeAsyncGracefully(io.servicetalk.grpc.protoc.Words.closeAsyncGracefully) BlockingRoute(io.servicetalk.grpc.protoc.Types.BlockingRoute) Words.onClose(io.servicetalk.grpc.protoc.Words.onClose) ProtoBufSerializationProviderBuilder(io.servicetalk.grpc.protoc.Types.ProtoBufSerializationProviderBuilder) System.lineSeparator(java.lang.System.lineSeparator) FieldSpec(com.squareup.javapoet.FieldSpec) Words.bind(io.servicetalk.grpc.protoc.Words.bind) PROTO_CONTENT_TYPE(io.servicetalk.grpc.protoc.Words.PROTO_CONTENT_TYPE) Builder(io.servicetalk.grpc.protoc.Words.Builder) Words.responseWriter(io.servicetalk.grpc.protoc.Words.responseWriter) TypeSpec.classBuilder(com.squareup.javapoet.TypeSpec.classBuilder) BlockingStreamingClientCall(io.servicetalk.grpc.protoc.Types.BlockingStreamingClientCall) Default(io.servicetalk.grpc.protoc.Words.Default) GrpcClient(io.servicetalk.grpc.protoc.Types.GrpcClient) GrpcClientFactory(io.servicetalk.grpc.protoc.Types.GrpcClientFactory) Client(io.servicetalk.grpc.protoc.Words.Client) PRIVATE(javax.lang.model.element.Modifier.PRIVATE) Words.methodDescriptors(io.servicetalk.grpc.protoc.Words.methodDescriptors) PUBLIC(javax.lang.model.element.Modifier.PUBLIC) StreamingClientCall(io.servicetalk.grpc.protoc.Types.StreamingClientCall) GrpcSerializationProvider(io.servicetalk.grpc.protoc.Types.GrpcSerializationProvider) Words.rpc(io.servicetalk.grpc.protoc.Words.rpc) STATIC(javax.lang.model.element.Modifier.STATIC) Words.close(io.servicetalk.grpc.protoc.Words.close) Publisher(io.servicetalk.grpc.protoc.Types.Publisher) BlockingResponseStreamingRoute(io.servicetalk.grpc.protoc.Types.BlockingResponseStreamingRoute) RequestStreamingClientCall(io.servicetalk.grpc.protoc.Types.RequestStreamingClientCall) Words.strategyFactory(io.servicetalk.grpc.protoc.Words.strategyFactory) ASYNC_METHOD_DESCRIPTORS(io.servicetalk.grpc.protoc.Words.ASYNC_METHOD_DESCRIPTORS) ClassName(com.squareup.javapoet.ClassName) TypeSpec(com.squareup.javapoet.TypeSpec)

Example 3 with DEFAULT

use of javax.lang.model.element.Modifier.DEFAULT in project webofneeds by researchstudio-sat.

the class ShapeTypeInterfacePopulator method postprocess.

@Override
public Map<TypeSpec, TypeSpec> postprocess(Set<TypeSpec> allTypes) {
    if (!config.isInterfacesForRdfTypes()) {
        return Collections.emptyMap();
    }
    Map<TypeSpec, TypeSpec> modifiedInterfaces = new HashMap<>();
    for (URI interfaceClassUri : shapeTypeInterfaceTypes.keySet()) {
        TypeSpec interfaceType = shapeTypeInterfaceTypes.get(interfaceClassUri).get();
        TypeSpec.Builder modifyingBuilder = interfaceType.toBuilder();
        Map<String, Set<MethodSpec>> candidateInterfaceMethodsByType = new HashMap<>();
        if (shapeTypeImplTypes.containsKey(interfaceClassUri)) {
            Optional<Set<TypeSpec>> implementingTypes = shapeTypeImplTypes.get(interfaceClassUri);
            if (implementingTypes.isPresent()) {
                for (TypeSpec type : implementingTypes.get()) {
                    // generate public abstract method with same signature and remember with type
                    // name
                    Set<MethodSpec> candidateInterfaceMethods = type.methodSpecs.stream().filter(m -> m.hasModifier(PUBLIC)).filter(m -> !m.isConstructor()).filter(m -> !m.name.equals("getNode")).filter(m -> !m.name.equals("setNode")).filter(m -> !Arrays.stream(Object.class.getMethods()).anyMatch(om -> om.getName().equals(m.name))).map(methodSpec -> {
                        MethodSpec.Builder b = MethodSpec.methodBuilder(methodSpec.name);
                        b.returns(methodSpec.returnType);
                        b.addTypeVariables(methodSpec.typeVariables);
                        methodSpec.parameters.forEach(p -> b.addParameter(p));
                        if (!methodSpec.returnType.equals(ClassName.VOID)) {
                            if (methodSpec.returnType.isPrimitive()) {
                                b.addStatement("return ($T) null", methodSpec.returnType.box());
                            } else {
                                b.addStatement("return null");
                            }
                        }
                        b.addModifiers(PUBLIC, DEFAULT);
                        return b.build();
                    }).collect(Collectors.toSet());
                    candidateInterfaceMethodsByType.put(type.name, candidateInterfaceMethods);
                }
            }
            Set<MethodSpec> commonMethodsForInterface = candidateInterfaceMethodsByType.values().stream().reduce(null, (left, right) -> {
                if (left == null) {
                    return right;
                } else if (right == null) {
                    return left;
                }
                HashSet<MethodSpec> intersection = new HashSet(left);
                intersection.retainAll(right);
                return intersection;
            });
            commonMethodsForInterface.forEach(m -> {
                if (logger.isDebugEnabled()) {
                    logger.debug("Adding interface method {} to interface {}", m.name, shapeTypeInterfaceTypes.get(interfaceClassUri).get().name);
                }
                modifyingBuilder.addMethod(m);
            });
        }
        modifiedInterfaces.put(interfaceType, modifyingBuilder.build());
    }
    return modifiedInterfaces;
}
Also used : Arrays(java.util.Arrays) Logger(org.slf4j.Logger) MethodSpec(com.squareup.javapoet.MethodSpec) ShapeTypeImplTypes(won.shacl2java.sourcegen.typegen.mapping.ShapeTypeImplTypes) ShapeTypeInterfaceTypes(won.shacl2java.sourcegen.typegen.mapping.ShapeTypeInterfaceTypes) MethodHandles(java.lang.invoke.MethodHandles) PUBLIC(javax.lang.model.element.Modifier.PUBLIC) LoggerFactory(org.slf4j.LoggerFactory) DEFAULT(javax.lang.model.element.Modifier.DEFAULT) ClassName(com.squareup.javapoet.ClassName) Set(java.util.Set) HashMap(java.util.HashMap) TypeSpec(com.squareup.javapoet.TypeSpec) Collectors(java.util.stream.Collectors) HashSet(java.util.HashSet) Map(java.util.Map) Shacl2JavaConfig(won.shacl2java.Shacl2JavaConfig) TypesPostprocessor(won.shacl2java.sourcegen.typegen.TypesPostprocessor) Optional(java.util.Optional) URI(java.net.URI) Collections(java.util.Collections) Set(java.util.Set) HashSet(java.util.HashSet) HashMap(java.util.HashMap) MethodSpec(com.squareup.javapoet.MethodSpec) URI(java.net.URI) TypeSpec(com.squareup.javapoet.TypeSpec) HashSet(java.util.HashSet)

Example 4 with DEFAULT

use of javax.lang.model.element.Modifier.DEFAULT in project servicetalk by apple.

the class Generator method addClientMetadata.

private TypeSpec.Builder addClientMetadata(final State state, final TypeSpec.Builder serviceClassBuilder) {
    state.serviceRpcInterfaces.stream().filter(rpcInterface -> !rpcInterface.blocking).forEach(rpcInterface -> {
        MethodDescriptorProto methodProto = rpcInterface.methodProto;
        final String name = context.deconflictJavaTypeName(sanitizeIdentifier(methodProto.getName(), false) + Metadata);
        final ClassName metaDataClassName = ClassName.bestGuess(name);
        final TypeSpec classSpec = classBuilder(name).addJavadoc(JAVADOC_DEPRECATED + "This class will be removed in the future in favor of direct " + "usage of {@link $T}. Deprecation of {@link $T#path()} renders this type unnecessary." + lineSeparator(), GrpcClientMetadata, GrpcClientMetadata).addAnnotation(Deprecated.class).addModifiers(PUBLIC, STATIC, FINAL).superclass(DefaultGrpcClientMetadata).addField(FieldSpec.builder(metaDataClassName, INSTANCE).addJavadoc(JAVADOC_DEPRECATED + "This class will be removed in the future in favor of direct usage of {@link $T}." + lineSeparator(), GrpcClientMetadata).addAnnotation(Deprecated.class).addModifiers(PUBLIC, STATIC, // redundant, default for interface field
        FINAL).initializer("new $T()", metaDataClassName).build()).addMethod(constructorBuilder().addModifiers(PRIVATE).addParameter(GrpcClientMetadata, metadata, FINAL).addStatement("super($T.$L, $L)", rpcInterface.className, RPC_PATH, metadata).build()).addMethod(constructorBuilder().addModifiers(PRIVATE).addStatement("super($T.$L)", rpcInterface.className, RPC_PATH).build()).addMethod(constructorBuilder().addModifiers(PUBLIC).addParameter(ContentCodec, requestEncoding, FINAL).addStatement("super($T.$L, $L)", rpcInterface.className, RPC_PATH, requestEncoding).build()).addMethod(constructorBuilder().addModifiers(PUBLIC).addParameter(GrpcExecutionStrategy, strategy, FINAL).addStatement("super($T.$L, $L)", rpcInterface.className, RPC_PATH, strategy).build()).addMethod(constructorBuilder().addModifiers(PUBLIC).addParameter(Duration.class, timeout, FINAL).addStatement("super($T.$L, $L)", rpcInterface.className, RPC_PATH, timeout).build()).addMethod(constructorBuilder().addModifiers(PUBLIC).addParameter(GrpcExecutionStrategy, strategy, FINAL).addParameter(ContentCodec, requestEncoding, FINAL).addStatement("super($T.$L, $L, $L)", rpcInterface.className, RPC_PATH, strategy, requestEncoding).build()).addMethod(constructorBuilder().addModifiers(PUBLIC).addParameter(GrpcExecutionStrategy, strategy, FINAL).addParameter(ContentCodec, requestEncoding, FINAL).addParameter(Duration.class, timeout, FINAL).addStatement("super($T.$L, $L, $L, $L)", rpcInterface.className, RPC_PATH, strategy, requestEncoding, timeout).build()).build();
        state.clientMetaDatas.add(new ClientMetaData(methodProto, metaDataClassName));
        serviceClassBuilder.addType(classSpec);
    });
    return serviceClassBuilder;
}
Also used : Arrays(io.servicetalk.grpc.protoc.Types.Arrays) Words.bufferDecoderGroup(io.servicetalk.grpc.protoc.Words.bufferDecoderGroup) Modifier(javax.lang.model.element.Modifier) RequestStreamingRoute(io.servicetalk.grpc.protoc.Types.RequestStreamingRoute) BlockingIterable(io.servicetalk.grpc.protoc.Types.BlockingIterable) AllGrpcRoutes(io.servicetalk.grpc.protoc.Types.AllGrpcRoutes) COMMENT_PRE_TAG(io.servicetalk.grpc.protoc.Words.COMMENT_PRE_TAG) GrpcExecutionStrategy(io.servicetalk.grpc.protoc.Types.GrpcExecutionStrategy) GrpcMethodDescriptor(io.servicetalk.grpc.protoc.Types.GrpcMethodDescriptor) Rpc(io.servicetalk.grpc.protoc.Words.Rpc) Words.factory(io.servicetalk.grpc.protoc.Words.factory) Words.request(io.servicetalk.grpc.protoc.Words.request) GrpcPayloadWriter(io.servicetalk.grpc.protoc.Types.GrpcPayloadWriter) FINAL(javax.lang.model.element.Modifier.FINAL) MethodDescriptorProto(com.google.protobuf.DescriptorProtos.MethodDescriptorProto) Duration(java.time.Duration) Map(java.util.Map) Words.isSupportedMessageCodingsEmpty(io.servicetalk.grpc.protoc.Words.isSupportedMessageCodingsEmpty) GrpcSupportedCodings(io.servicetalk.grpc.protoc.Types.GrpcSupportedCodings) Route(io.servicetalk.grpc.protoc.Types.Route) BlockingRequestStreamingRoute(io.servicetalk.grpc.protoc.Types.BlockingRequestStreamingRoute) DefaultGrpcClientMetadata(io.servicetalk.grpc.protoc.Types.DefaultGrpcClientMetadata) Words.initSerializationProvider(io.servicetalk.grpc.protoc.Words.initSerializationProvider) EnumSet(java.util.EnumSet) ResponseStreamingRoute(io.servicetalk.grpc.protoc.Types.ResponseStreamingRoute) Call(io.servicetalk.grpc.protoc.Words.Call) StringUtils.escapeJavaDoc(io.servicetalk.grpc.protoc.StringUtils.escapeJavaDoc) ContentCodec(io.servicetalk.grpc.protoc.Types.ContentCodec) JAVADOC_THROWS(io.servicetalk.grpc.protoc.Words.JAVADOC_THROWS) Single(io.servicetalk.grpc.protoc.Types.Single) Words.routes(io.servicetalk.grpc.protoc.Words.routes) GrpcMethodDescriptorCollection(io.servicetalk.grpc.protoc.Types.GrpcMethodDescriptorCollection) StringUtils.sanitizeIdentifier(io.servicetalk.grpc.protoc.StringUtils.sanitizeIdentifier) GrpcMethodDescriptors(io.servicetalk.grpc.protoc.Types.GrpcMethodDescriptors) Collectors.joining(java.util.stream.Collectors.joining) Words.strategy(io.servicetalk.grpc.protoc.Words.strategy) BlockingStreamingRoute(io.servicetalk.grpc.protoc.Types.BlockingStreamingRoute) BLOCKING_METHOD_DESCRIPTORS(io.servicetalk.grpc.protoc.Words.BLOCKING_METHOD_DESCRIPTORS) Words.executionContext(io.servicetalk.grpc.protoc.Words.executionContext) Words.metadata(io.servicetalk.grpc.protoc.Words.metadata) EnumSet.noneOf(java.util.EnumSet.noneOf) BlockingGrpcClient(io.servicetalk.grpc.protoc.Types.BlockingGrpcClient) JAVADOC_PARAM(io.servicetalk.grpc.protoc.Words.JAVADOC_PARAM) DEFAULT(javax.lang.model.element.Modifier.DEFAULT) RouteExecutionStrategyFactory(io.servicetalk.grpc.protoc.Types.RouteExecutionStrategyFactory) GrpcClientMetadata(io.servicetalk.grpc.protoc.Types.GrpcClientMetadata) GrpcService(io.servicetalk.grpc.protoc.Types.GrpcService) BlockingResponseStreamingClientCall(io.servicetalk.grpc.protoc.Types.BlockingResponseStreamingClientCall) Words.service(io.servicetalk.grpc.protoc.Words.service) ArrayList(java.util.ArrayList) Words.addService(io.servicetalk.grpc.protoc.Words.addService) Stream.concat(java.util.stream.Stream.concat) Completable(io.servicetalk.grpc.protoc.Types.Completable) JAVADOC_DEPRECATED(io.servicetalk.grpc.protoc.Words.JAVADOC_DEPRECATED) CodeBlock(com.squareup.javapoet.CodeBlock) Nullable(javax.annotation.Nullable) TypeSpec.interfaceBuilder(com.squareup.javapoet.TypeSpec.interfaceBuilder) NOOP_MAP(io.servicetalk.grpc.protoc.NoopServiceCommentsMap.NOOP_MAP) RPC_PATH(io.servicetalk.grpc.protoc.Words.RPC_PATH) BLOCKING(io.servicetalk.grpc.protoc.Generator.NewRpcMethodFlag.BLOCKING) Collections(io.servicetalk.grpc.protoc.Types.Collections) Objects(io.servicetalk.grpc.protoc.Types.Objects) COMMENT_POST_TAG(io.servicetalk.grpc.protoc.Words.COMMENT_POST_TAG) INTERFACE(io.servicetalk.grpc.protoc.Generator.NewRpcMethodFlag.INTERFACE) Words.closeAsync(io.servicetalk.grpc.protoc.Words.closeAsync) PROTOBUF(io.servicetalk.grpc.protoc.Words.PROTOBUF) MethodSpec(com.squareup.javapoet.MethodSpec) Words.methodDescriptor(io.servicetalk.grpc.protoc.Words.methodDescriptor) GrpcRouteExecutionStrategyFactory(io.servicetalk.grpc.protoc.Types.GrpcRouteExecutionStrategyFactory) Words.registerRoutes(io.servicetalk.grpc.protoc.Words.registerRoutes) ParameterizedTypeName(com.squareup.javapoet.ParameterizedTypeName) INSTANCE(io.servicetalk.grpc.protoc.Words.INSTANCE) TypeSpec(com.squareup.javapoet.TypeSpec) Words.client(io.servicetalk.grpc.protoc.Words.client) BlockingGrpcService(io.servicetalk.grpc.protoc.Types.BlockingGrpcService) BufferDecoderGroup(io.servicetalk.grpc.protoc.Types.BufferDecoderGroup) Words.bufferEncoders(io.servicetalk.grpc.protoc.Words.bufferEncoders) Words.closeable(io.servicetalk.grpc.protoc.Words.closeable) PROTECTED(javax.lang.model.element.Modifier.PROTECTED) Service(io.servicetalk.grpc.protoc.Words.Service) GrpcClientCallFactory(io.servicetalk.grpc.protoc.Types.GrpcClientCallFactory) BlockingClientCall(io.servicetalk.grpc.protoc.Types.BlockingClientCall) Factory(io.servicetalk.grpc.protoc.Words.Factory) MethodSpec.methodBuilder(com.squareup.javapoet.MethodSpec.methodBuilder) Words.addBlockingService(io.servicetalk.grpc.protoc.Words.addBlockingService) BOOLEAN(com.squareup.javapoet.TypeName.BOOLEAN) Words.timeout(io.servicetalk.grpc.protoc.Words.timeout) GrpcRoutes(io.servicetalk.grpc.protoc.Types.GrpcRoutes) Words.requestEncoding(io.servicetalk.grpc.protoc.Words.requestEncoding) ServiceDescriptorProto(com.google.protobuf.DescriptorProtos.ServiceDescriptorProto) BiFunction(java.util.function.BiFunction) ClassName(com.squareup.javapoet.ClassName) CLIENT(io.servicetalk.grpc.protoc.Generator.NewRpcMethodFlag.CLIENT) EmptyBufferDecoderGroup(io.servicetalk.grpc.protoc.Types.EmptyBufferDecoderGroup) JAVADOC_CONSTRUCTOR_DEFAULT_STATEMENT(io.servicetalk.grpc.protoc.Words.JAVADOC_CONSTRUCTOR_DEFAULT_STATEMENT) ResponseStreamingClientCall(io.servicetalk.grpc.protoc.Types.ResponseStreamingClientCall) Identity(io.servicetalk.grpc.protoc.Types.Identity) Metadata(io.servicetalk.grpc.protoc.Words.Metadata) BlockingRequestStreamingClientCall(io.servicetalk.grpc.protoc.Types.BlockingRequestStreamingClientCall) AsyncCloseable(io.servicetalk.grpc.protoc.Types.AsyncCloseable) GrpcStatusException(io.servicetalk.grpc.protoc.Types.GrpcStatusException) GrpcBindableService(io.servicetalk.grpc.protoc.Types.GrpcBindableService) To(io.servicetalk.grpc.protoc.Words.To) GrpcExecutionContext(io.servicetalk.grpc.protoc.Types.GrpcExecutionContext) JAVADOC_RETURN(io.servicetalk.grpc.protoc.Words.JAVADOC_RETURN) SourceCodeInfo(com.google.protobuf.DescriptorProtos.SourceCodeInfo) ABSTRACT(javax.lang.model.element.Modifier.ABSTRACT) BufferEncoderList(io.servicetalk.grpc.protoc.Types.BufferEncoderList) RouteExecutionStrategy(io.servicetalk.grpc.protoc.Types.RouteExecutionStrategy) Words.builder(io.servicetalk.grpc.protoc.Words.builder) MethodSpec.constructorBuilder(com.squareup.javapoet.MethodSpec.constructorBuilder) Blocking(io.servicetalk.grpc.protoc.Words.Blocking) GrpcServiceContext(io.servicetalk.grpc.protoc.Types.GrpcServiceContext) Words.ctx(io.servicetalk.grpc.protoc.Words.ctx) ProtobufSerializerFactory(io.servicetalk.grpc.protoc.Types.ProtobufSerializerFactory) List(java.util.List) ClientCall(io.servicetalk.grpc.protoc.Types.ClientCall) Words.supportedMessageCodings(io.servicetalk.grpc.protoc.Words.supportedMessageCodings) Words.closeGracefully(io.servicetalk.grpc.protoc.Words.closeGracefully) GrpcServiceFactory(io.servicetalk.grpc.protoc.Types.GrpcServiceFactory) StreamingRoute(io.servicetalk.grpc.protoc.Types.StreamingRoute) Words.closeAsyncGracefully(io.servicetalk.grpc.protoc.Words.closeAsyncGracefully) BlockingRoute(io.servicetalk.grpc.protoc.Types.BlockingRoute) Words.onClose(io.servicetalk.grpc.protoc.Words.onClose) ProtoBufSerializationProviderBuilder(io.servicetalk.grpc.protoc.Types.ProtoBufSerializationProviderBuilder) System.lineSeparator(java.lang.System.lineSeparator) FieldSpec(com.squareup.javapoet.FieldSpec) Words.bind(io.servicetalk.grpc.protoc.Words.bind) PROTO_CONTENT_TYPE(io.servicetalk.grpc.protoc.Words.PROTO_CONTENT_TYPE) Builder(io.servicetalk.grpc.protoc.Words.Builder) Words.responseWriter(io.servicetalk.grpc.protoc.Words.responseWriter) TypeSpec.classBuilder(com.squareup.javapoet.TypeSpec.classBuilder) BlockingStreamingClientCall(io.servicetalk.grpc.protoc.Types.BlockingStreamingClientCall) Default(io.servicetalk.grpc.protoc.Words.Default) GrpcClient(io.servicetalk.grpc.protoc.Types.GrpcClient) GrpcClientFactory(io.servicetalk.grpc.protoc.Types.GrpcClientFactory) Client(io.servicetalk.grpc.protoc.Words.Client) PRIVATE(javax.lang.model.element.Modifier.PRIVATE) Words.methodDescriptors(io.servicetalk.grpc.protoc.Words.methodDescriptors) PUBLIC(javax.lang.model.element.Modifier.PUBLIC) StreamingClientCall(io.servicetalk.grpc.protoc.Types.StreamingClientCall) GrpcSerializationProvider(io.servicetalk.grpc.protoc.Types.GrpcSerializationProvider) Words.rpc(io.servicetalk.grpc.protoc.Words.rpc) STATIC(javax.lang.model.element.Modifier.STATIC) Words.close(io.servicetalk.grpc.protoc.Words.close) Publisher(io.servicetalk.grpc.protoc.Types.Publisher) BlockingResponseStreamingRoute(io.servicetalk.grpc.protoc.Types.BlockingResponseStreamingRoute) RequestStreamingClientCall(io.servicetalk.grpc.protoc.Types.RequestStreamingClientCall) Words.strategyFactory(io.servicetalk.grpc.protoc.Words.strategyFactory) ASYNC_METHOD_DESCRIPTORS(io.servicetalk.grpc.protoc.Words.ASYNC_METHOD_DESCRIPTORS) ClassName(com.squareup.javapoet.ClassName) MethodDescriptorProto(com.google.protobuf.DescriptorProtos.MethodDescriptorProto) TypeSpec(com.squareup.javapoet.TypeSpec)

Aggregations

ClassName (com.squareup.javapoet.ClassName)4 MethodSpec (com.squareup.javapoet.MethodSpec)4 TypeSpec (com.squareup.javapoet.TypeSpec)4 MethodDescriptorProto (com.google.protobuf.DescriptorProtos.MethodDescriptorProto)3 ServiceDescriptorProto (com.google.protobuf.DescriptorProtos.ServiceDescriptorProto)3 SourceCodeInfo (com.google.protobuf.DescriptorProtos.SourceCodeInfo)3 CodeBlock (com.squareup.javapoet.CodeBlock)3 FieldSpec (com.squareup.javapoet.FieldSpec)3 MethodSpec.constructorBuilder (com.squareup.javapoet.MethodSpec.constructorBuilder)3 MethodSpec.methodBuilder (com.squareup.javapoet.MethodSpec.methodBuilder)3 ParameterizedTypeName (com.squareup.javapoet.ParameterizedTypeName)3 BOOLEAN (com.squareup.javapoet.TypeName.BOOLEAN)3 TypeSpec.classBuilder (com.squareup.javapoet.TypeSpec.classBuilder)3 TypeSpec.interfaceBuilder (com.squareup.javapoet.TypeSpec.interfaceBuilder)3 BLOCKING (io.servicetalk.grpc.protoc.Generator.NewRpcMethodFlag.BLOCKING)3 CLIENT (io.servicetalk.grpc.protoc.Generator.NewRpcMethodFlag.CLIENT)3 INTERFACE (io.servicetalk.grpc.protoc.Generator.NewRpcMethodFlag.INTERFACE)3 NOOP_MAP (io.servicetalk.grpc.protoc.NoopServiceCommentsMap.NOOP_MAP)3 StringUtils.escapeJavaDoc (io.servicetalk.grpc.protoc.StringUtils.escapeJavaDoc)3 StringUtils.sanitizeIdentifier (io.servicetalk.grpc.protoc.StringUtils.sanitizeIdentifier)3