Extensions

nscn.polaris2.protoc.codegen.Extensions
object Extensions

This project's option extensions, typed as ExtensionLite.

The annotation is what makes them usable from Scala at all. hasExtension/getExtension are overloaded three ways - for GeneratedExtension, Extension and ExtensionLite - and since the generated constant's type satisfies all three, Scala reports "Ambiguous overload" where Java would pick the most specific one. Widening each constant to the least specific type leaves exactly one applicable overload.

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type
Extensions.type

Members list

Value members

Concrete methods

def registerAll(registry: ExtensionRegistry): Unit

Registers all of them, so protoc's request parses them as extensions.

Registers all of them, so protoc's request parses them as extensions.

Without this the options arrive as unknown fields on the descriptor and hasExtension reports false, so every custom option silently reads back as its default: a package_name is ignored, a flat_package has no effect, and nothing fails. Options.registerAllExtensions cannot be called from Scala for the same overload reason as above, so the extensions are added one at a time, typed as the Extension the full registry wants.

Attributes

Concrete fields

val enumOptions: ExtensionLite[EnumOptions, ScalaEnumOptions]
val enumValue: ExtensionLite[EnumValueOptions, ScalaEnumValueOptions]
val field: ExtensionLite[FieldOptions, ScalaFieldOptions]
val file: ExtensionLite[FileOptions, ScalaFileOptions]
val message: ExtensionLite[MessageOptions, ScalaMessageOptions]
val oneof: ExtensionLite[OneofOptions, ScalaOneofOptions]