Class ProtobufMessageBuilders
java.lang.Object
io.micronaut.protobuf.ProtobufMessageBuilders
Creates Protocol Buffers message builders.
Uses the ProtobufMessageFactory generated at compile time by micronaut-protobuff-processor for the
message type. Factories are looked up through the message type's own class loader, and the result is cached per
message class, so nothing keeps a class loader alive after its classes are unloaded.
For compatibility only, a message compiled without the processor, for example one from a shared library, falls
back to calling its static newBuilder() method by reflection.
- Since:
- 5.3.0
-
Method Summary
Modifier and TypeMethodDescriptionstatic booleanhasGeneratedFactory(Class<? extends com.google.protobuf.Message> type) Whether a builder for the type is created without reflection.static com.google.protobuf.Message.BuildernewBuilder(Class<? extends com.google.protobuf.Message> type) Creates a builder for a message type.
-
Method Details
-
newBuilder
public static com.google.protobuf.Message.Builder newBuilder(Class<? extends com.google.protobuf.Message> type) Creates a builder for a message type.- Parameters:
type- The message type- Returns:
- A new builder
- Throws:
IllegalArgumentException- if the type has no staticnewBuilder()method
-
hasGeneratedFactory
Whether a builder for the type is created without reflection.- Parameters:
type- The message type- Returns:
- True if a generated
ProtobufMessageFactoryexists for the type
-