Class ProtobufMessageFactoryVisitor
java.lang.Object
io.micronaut.protobuf.processor.ProtobufMessageFactoryVisitor
- All Implemented Interfaces:
io.micronaut.core.order.Ordered, io.micronaut.core.util.Toggleable, io.micronaut.inject.visitor.TypeElementVisitor<Object,Object>
@Internal
public final class ProtobufMessageFactoryVisitor
extends Object
implements io.micronaut.inject.visitor.TypeElementVisitor<Object,Object>
Generates an
io.micronaut.protobuf.ProtobufMessageFactory for every Protocol Buffers message class that
protoc generates, so that message builders are created without reflection.
Generated message classes are annotated with @com.google.protobuf.Generated. For each one that implements
com.google.protobuf.Message, the visitor writes a small factory class that calls the message's static
newBuilder() method, and registers it as a service. Messages in the default package are skipped and keep the
reflective fallback.
protoc only annotates the classes it writes to their own file. With the default
java_multiple_files = false layout the messages are nested in an outer wrapper class, and only the wrapper
carries the annotation, so incremental processing selects just the wrapper. Every visited class is therefore
traversed for nested message classes as well.
- Since:
- 5.3.0
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.micronaut.inject.visitor.TypeElementVisitor
io.micronaut.inject.visitor.TypeElementVisitor.VisitorKind -
Field Summary
Fields inherited from interface io.micronaut.core.order.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionio.micronaut.inject.visitor.TypeElementVisitor.VisitorKindvoidvisitClass(io.micronaut.inject.ast.ClassElement element, io.micronaut.inject.visitor.VisitorContext context) Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.micronaut.core.order.Ordered
getOrderMethods inherited from interface io.micronaut.core.util.Toggleable
isEnabledMethods inherited from interface io.micronaut.inject.visitor.TypeElementVisitor
finish, getClassType, getElementType, getSupportedOptions, query, start, visitConstructor, visitEnumConstant, visitField, visitMethod
-
Constructor Details
-
ProtobufMessageFactoryVisitor
public ProtobufMessageFactoryVisitor()
-
-
Method Details
-
getSupportedAnnotationNames
-
getVisitorKind
-
visitClass
-