Class BaseProtoSchemaGenerator

java.lang.Object
org.infinispan.protostream.annotations.impl.BaseProtoSchemaGenerator

public abstract class BaseProtoSchemaGenerator extends Object
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
Author:
[email protected]
  • Field Details

    • generateSchemaDebugComments

      public static boolean generateSchemaDebugComments
      Set this flag to true to enable output of debug comments in the generated Protobuf schema.
    • generateMarshallerDebugComments

      public static boolean generateMarshallerDebugComments
      Set this flag to true to enable output of debug comments in the generated marshaller source code.
    • typeFactory

      protected final XTypeFactory typeFactory
    • serializationContext

      protected final SerializationContext serializationContext
    • fileName

      protected final String fileName
      Protobuf schema file name.
    • generator

      protected final String generator
    • packageName

      protected final String packageName
      Protobuf schema package name.
    • classes

      protected final Set<XClass> classes
      Initial set of classes.
    • autoImportClasses

      protected final boolean autoImportClasses
      Indicates if class dependencies are automatically added when discovered or will generate an error.
  • Constructor Details

  • Method Details

    • syntax

      public ProtoSyntax syntax()
    • generateAndRegister

      public String generateAndRegister()
    • getMarshalledClasses

      public Set<XClass> getMarshalledClasses()
    • makeMarshallerCodeGenerator

      protected abstract AbstractMarshallerCodeGenerator makeMarshallerCodeGenerator()
      Creates a code generator for marshallers.
    • scanAnnotations

      protected ProtoTypeMetadata scanAnnotations(XClass javaType)
    • importProtoTypeMetadata

      protected abstract ProtoTypeMetadata importProtoTypeMetadata(XClass javaType)
      Return an imported ProtoTypeMetadata implementation or null if it cannot be imported.
    • makeTypeMetadata

      protected ProtoTypeMetadata makeTypeMetadata(XClass javaType)
    • makeEnumTypeMetadata

      protected ProtoTypeMetadata makeEnumTypeMetadata(XClass javaType)
    • makeMessageTypeMetadata

      protected ProtoTypeMetadata makeMessageTypeMetadata(XClass javaType)
    • isUnknownClass

      protected boolean isUnknownClass(XClass c)
    • getAdapterFor

      protected XClass getAdapterFor(XClass annotatedClass)
    • getTargetClass

      protected XClass getTargetClass(XClass annotatedClass)
      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.