Class GrpcProtoDescriptors
java.lang.Object
io.helidon.declarative.codegen.grpc.GrpcProtoDescriptors
Utilities for declarative gRPC proto descriptors.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumDeclarative gRPC method cardinality shared by client and server code generation. -
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddRuntimeMethodTypeMethod(ClassModel.Builder classModel) Add the generated runtime method cardinality formatter.static voidaddRuntimeValidationMethod(ClassModel.Builder classModel, TypeName protoFileDescriptor, TypeName protoMessageDescriptor) Add the generated runtime proto method validation.static GrpcProtoDescriptorfind(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.methodType(TypedElementInfo method, Annotation grpcMethod, String declarationType) Read and validate a declarative gRPC method cardinality.static voidvalidateMessageType(RegistryCodegenContext ctx, TypeInfo declaration, TypeName messageType, TypeName protoMessageDescriptor, String role) Validate that a declared request or response type is a generated protobuf message type.
-
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 contexttypeInfo- type to inspecttypeAnnotations- annotations on the typeprotoAnnotation-@Grpc.PrototypeprotoDescriptorAnnotation-@Grpc.ProtoDescriptortypegrpcMethodAnnotation- gRPC method meta-annotation typeprotoFileDescriptor- protobuf file descriptor typedeclarationType- 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 contextdeclaration- declarative gRPC declarationmessageType- request or response typeprotoMessageDescriptor- protobuf message descriptor typerole- 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 modelprotoFileDescriptor- protobuf file descriptor typeprotoMessageDescriptor- protobuf message descriptor type
-
addRuntimeMethodTypeMethod
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 methodgrpcMethod- gRPC method annotationdeclarationType- client or server- Returns:
- method cardinality
-