GenContext

nscn.polaris2.protoc.codegen.GenContext
final class GenContext(val params: GeneratorParams, val fileOptions: FileOptionsResolver)

Everything the generators need that is not on a descriptor.

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Value members

Concrete methods

def defaultsInConstructor(field: FieldDescriptor): Boolean

Whether a message's constructor parameters get defaults at all.

Whether a message's constructor parameters get defaults at all.

Precedence runs field, then message, then file, then the command line - most specific wins, which is how every other option here behaves.

Attributes

def enumOptions(descriptor: EnumDescriptor): ScalaEnumOptions
def enumValueOptions(descriptor: EnumValueDescriptor): ScalaEnumValueOptions
def fieldOptions(descriptor: FieldDescriptor): ScalaFieldOptions
def fileObjectName(file: FileDescriptor): String

The file-level object holding the descriptors and companion lists.

The file-level object holding the descriptors and companion lists.

Attributes

def fullName(descriptor: Descriptor): String
def fullName(descriptor: EnumDescriptor): String
def lensesRequested(file: FileDescriptor): Boolean

Whether lenses were asked for.

Whether lenses were asked for.

Read only so the generator can reject the request. Lenses are not implemented, and accepting the option while emitting nothing is the same failure mode as an option that never reaches the generator at all: configuration that looks applied and is not.

Attributes

def messageOptions(descriptor: Descriptor): ScalaMessageOptions
def oneofOptions(descriptor: OneofDescriptor): ScalaOneofOptions
def optionsFor(file: FileDescriptor): ScalaFileOptions
def preserveUnknownFields(file: FileDescriptor): Boolean
def relativeName(descriptor: Descriptor): String

The Scala path of a message relative to its package, e.g. Person.Nested.

The Scala path of a message relative to its package, e.g. Person.Nested.

Attributes

def relativeName(descriptor: EnumDescriptor): String
def retainSourceCodeInfo(file: FileDescriptor): Boolean

Whether the descriptors keep protoc's source-code info.

Whether the descriptors keep protoc's source-code info.

Either the command-line parameter or the file option turns it on. Reading only the file option would make --scala3_opt=retain_source_code_info silently do nothing.

Attributes

def scalaPackage(file: FileDescriptor): String

The Scala package a file's types land in.

The Scala package a file's types land in.

package_name wins, then java_package, then the proto package. Unless the layout is flat, the file's base name is appended, which is what keeps two files in the same proto package from colliding when both declare a Status enum.

Attributes