Interface Generator

All Known Implementing Classes:
CodecGenerator, JsonCodecGenerator, ModelGenerator, SchemaGenerator, TestGenerator

public interface Generator
Interface for a code generator from protobuf message definition
  • Field Details

  • Method Details

    • generate

      void generate(Protobuf3Parser.MessageDefContext msgDef, JavaFileWriter writer, ContextualLookupHelper lookupHelper) throws IOException
      Generate a code from protobuf message type
      Parameters:
      msgDef - the parsed message
      lookupHelper - Lookup helper for global context lookups
      Throws:
      IOException - if there was a problem writing generated code
    • isInner

      static boolean isInner(Protobuf3Parser.MessageDefContext msgDef)
      A utility method to check if a type being generated is an inner message or not. The result returned by this method should only affect minor details of the generated code, such as whether to add a `static` modifier to the class definition and similar. The result MUST NOT be used to choose whether to actually inline the type definition or go and create physical files on disk with an actual top-level type definition. This method is NOT SUPPOSED to help make such decisions. A Generator implementation MUST NEVER create new files for top-level types generation on its own. The Generator MUST emit all generated code into a given JavaFileWriter instance and let it (and its owner) decide where the output should go.
      Parameters:
      msgDef - a MessageDefContext object
      Returns:
      true if the given MessageDefContext is nested inside an outer MessageDefContext