Class GrpcProtoDescriptors

java.lang.Object
io.helidon.declarative.codegen.grpc.GrpcProtoDescriptors

public final class GrpcProtoDescriptors extends Object
Utilities for declarative gRPC proto descriptors.
  • Method Details

    • find

      public static GrpcProtoDescriptor find(RegistryCodegenContext ctx, TypeInfo typeInfo, List<Annotation> typeAnnotations, TypeName protoAnnotation, TypeName protoDescriptorAnnotation, TypeName grpcMethodAnnotation, TypeName protoFileDescriptor, String declarationType)
      Find and validate the proto descriptor source declared by a declarative gRPC type.
      Parameters:
      ctx - codegen context
      typeInfo - type to inspect
      typeAnnotations - annotations on the type
      protoAnnotation - @Grpc.Proto type
      protoDescriptorAnnotation - @Grpc.ProtoDescriptor type
      grpcMethodAnnotation - gRPC method meta-annotation type
      protoFileDescriptor - protobuf file descriptor type
      declarationType - user-facing declaration type
      Returns:
      proto descriptor source
    • validateMessageType

      public static void validateMessageType(RegistryCodegenContext ctx, TypeInfo declaration, TypeName messageType, TypeName protoMessageDescriptor, String role)
      Validate that a declared request or response type is a generated protobuf message type.
      Parameters:
      ctx - codegen context
      declaration - declarative gRPC declaration
      messageType - request or response type
      protoMessageDescriptor - protobuf message descriptor type
      role - request or response
    • addRuntimeValidationMethod

      public static void addRuntimeValidationMethod(ClassModel.Builder classModel, TypeName protoFileDescriptor, TypeName protoMessageDescriptor)
      Add the generated runtime proto method validation.
      Parameters:
      classModel - generated class model
      protoFileDescriptor - protobuf file descriptor type
      protoMessageDescriptor - protobuf message descriptor type
    • addRuntimeMethodTypeMethod

      public static void addRuntimeMethodTypeMethod(ClassModel.Builder classModel)
      Add the generated runtime method cardinality formatter.
      Parameters:
      classModel - generated class model
    • methodType

      public static GrpcProtoDescriptors.MethodType methodType(TypedElementInfo method, Annotation grpcMethod, String declarationType)
      Read and validate a declarative gRPC method cardinality.
      Parameters:
      method - annotated method
      grpcMethod - gRPC method annotation
      declarationType - client or server
      Returns:
      method cardinality