Class BaseProtoSchemaGenerator
java.lang.Object
org.infinispan.protostream.annotations.impl.BaseProtoSchemaGenerator
- Direct Known Subclasses:
CompileTimeProtoSchemaGenerator
Generates a protobuf schema (proto file) based on annotations and also generates marshallers for the types.
This class is not to be directly invoked by users.
Generators are not expected to be stateless, so reuse must be done taking this into account.
- Since:
- 3.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final booleanprotected final booleanIndicates if class dependencies are automatically added when discovered or will generate an error.Initial set of classes.protected final StringProtobuf schema file name.static booleanSet this flag totrueto enable output of debug comments in the generated marshaller source code.static booleanSet this flag totrueto enable output of debug comments in the generated Protobuf schema.protected final StringThe imported schema files.Known classes: the user-added classes (classes) plus all their superclasses and superinterfaces.private static final Logprivate final Map<XClass, ProtoTypeMetadata> private final Map<String, ProtoTypeMetadata> protected final StringProtobuf schema package name.protected final SerializationContextprivate final ProtoSyntaxprotected final XTypeFactory -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedBaseProtoSchemaGenerator(XTypeFactory typeFactory, SerializationContext serializationContext, String generator, String fileName, String packageName, Set<XClass> classes, boolean autoImportClasses, ProtoSyntax syntax, boolean allowNullFields) -
Method Summary
Modifier and TypeMethodDescriptionbooleanprivate voidCollect all superclasses and superinterfaces.(package private) voidcollectMetadata(ProtoTypeMetadata protoTypeMetadata) private ProtoMessageTypeMetadataprivate voidprotected XClassgetAdapterFor(XClass annotatedClass) protected XClassgetTargetClass(XClass annotatedClass) Get the marshalled class or enum.protected abstract ProtoTypeMetadataimportProtoTypeMetadata(XClass javaType) Return an imported ProtoTypeMetadata implementation or null if it cannot be imported.protected booleanprotected ProtoTypeMetadatamakeEnumTypeMetadata(XClass javaType) protected abstract AbstractMarshallerCodeGeneratorCreates a code generator for marshallers.protected ProtoTypeMetadatamakeMessageTypeMetadata(XClass javaType) protected ProtoTypeMetadatamakeTypeMetadata(XClass javaType) protected ProtoTypeMetadatascanAnnotations(XClass javaType) syntax()
-
Field Details
-
log
-
generateSchemaDebugComments
public static boolean generateSchemaDebugCommentsSet this flag totrueto enable output of debug comments in the generated Protobuf schema. -
generateMarshallerDebugComments
public static boolean generateMarshallerDebugCommentsSet this flag totrueto enable output of debug comments in the generated marshaller source code. -
typeFactory
-
serializationContext
-
fileName
Protobuf schema file name. -
generator
-
packageName
Protobuf schema package name. -
classes
Initial set of classes. -
autoImportClasses
protected final boolean autoImportClassesIndicates if class dependencies are automatically added when discovered or will generate an error. -
knownClasses
Known classes: the user-added classes (classes) plus all their superclasses and superinterfaces. This is only used when auto-import is disabled. -
imports
The imported schema files. -
metadataByClass
-
metadataByTypeName
-
syntax
-
allowNullFields
private final boolean allowNullFields
-
-
Constructor Details
-
BaseProtoSchemaGenerator
protected BaseProtoSchemaGenerator(XTypeFactory typeFactory, SerializationContext serializationContext, String generator, String fileName, String packageName, Set<XClass> classes, boolean autoImportClasses, ProtoSyntax syntax, boolean allowNullFields)
-
-
Method Details
-
allowNullFields
public boolean allowNullFields() -
syntax
-
generateAndRegister
-
findOuterType
-
generateMarshallers
- Throws:
Exception
-
getMarshalledClasses
-
makeMarshallerCodeGenerator
Creates a code generator for marshallers. -
scanAnnotations
-
importProtoTypeMetadata
Return an imported ProtoTypeMetadata implementation or null if it cannot be imported. -
makeTypeMetadata
-
makeEnumTypeMetadata
-
makeMessageTypeMetadata
-
collectMetadata
-
isUnknownClass
-
collectKnownClasses
Collect all superclasses and superinterfaces. -
getAdapterFor
-
getTargetClass
Get the marshalled class or enum. The marshalled class and the annotated class are not always the same, depending on the presence of the ProtoAdapter annotation which may establish a new target.
-