WithGrpcMarshaller

Available in a dev version: 0․11․0-grpc-186

How to configure

@Target(allowedTargets = [AnnotationTarget.CLASS])
expect annotation class WithGrpcMarshaller(val marshaller: KClass<out GrpcMarshaller<*>>)(source)

Specifies a custom GrpcMarshaller for encoding and decoding a message type in gRPC communication.

If a gRPC service uses a message type annotated with this annotation, the generated gRPC stubs will use the specified marshaller to encode and decode instances of that type.

The GrpcMarshaller for a type annotated with WithGrpcMarshaller can be retrieved using the marshaller function.

Example:

@WithGrpcMarshaller(ChatEntryMarshaller::class)
class ChatEntry(...)
object ChatEntryMarshaller : GrpcMarshaller<ChatEntry> { ... }

val marshaller = grpcMarshallerOf<ChatEntry>()

Note: The referenced GrpcMarshaller must be an object.

See also

@Target(allowedTargets = [AnnotationTarget.CLASS])
actual annotation class WithGrpcMarshaller(val marshaller: KClass<out GrpcMarshaller<*>>)(source)

Specifies a custom GrpcMarshaller for encoding and decoding a message type in gRPC communication.

If a gRPC service uses a message type annotated with this annotation, the generated gRPC stubs will use the specified marshaller to encode and decode instances of that type.

The GrpcMarshaller for a type annotated with WithGrpcMarshaller can be retrieved using the marshaller function.

Example:

@WithGrpcMarshaller(ChatEntryMarshaller::class)
class ChatEntry(...)
object ChatEntryMarshaller : GrpcMarshaller<ChatEntry> { ... }

val marshaller = grpcMarshallerOf<ChatEntry>()

Note: The referenced GrpcMarshaller must be an object.

See also

@Target(allowedTargets = [AnnotationTarget.CLASS])
actual annotation class WithGrpcMarshaller(val marshaller: KClass<out GrpcMarshaller<*>>)(source)

Specifies a custom GrpcMarshaller for encoding and decoding a message type in gRPC communication.

If a gRPC service uses a message type annotated with this annotation, the generated gRPC stubs will use the specified marshaller to encode and decode instances of that type.

The GrpcMarshaller for a type annotated with WithGrpcMarshaller can be retrieved using the marshaller function.

Example:

@WithGrpcMarshaller(ChatEntryMarshaller::class)
class ChatEntry(...)
object ChatEntryMarshaller : GrpcMarshaller<ChatEntry> { ... }

val marshaller = grpcMarshallerOf<ChatEntry>()

Note: The referenced GrpcMarshaller must be an object.

See also

Properties

Link copied to clipboard
expect val marshaller: KClass<out GrpcMarshaller<*>>

The GrpcMarshaller object responsible for encoding and decoding instances of the annotated type.

actual val marshaller: KClass<out GrpcMarshaller<*>>

The GrpcMarshaller object responsible for encoding and decoding instances of the annotated type.

actual val marshaller: KClass<out GrpcMarshaller<*>>

The GrpcMarshaller object responsible for encoding and decoding instances of the annotated type.