Linker

class Linker

Links local field types and option types to the corresponding declarations.

Constructors

Link copied to clipboard
constructor(loader: Loader, errors: ErrorCollector, permitPackageCycles: Boolean, loadExhaustively: Boolean, opaqueTypes: List<ProtoType>)
constructor(loader: Loader, errors: ErrorCollector, permitPackageCycles: Boolean, loadExhaustively: Boolean)

Properties

Link copied to clipboard

Errors accumulated by this load.

Link copied to clipboard

Functions

Link copied to clipboard
fun addType(protoType: ProtoType, type: Type)

Adds type.

Link copied to clipboard
fun dereference(protoType: ProtoType, field: String): Field?

Returns the field named field on the message type of protoType.

Link copied to clipboard
fun get(protoType: ProtoType): Type?

Returns the type or null if it doesn't exist.

Link copied to clipboard
fun getForOptions(protoType: ProtoType): Type?

Returns the type or null if it doesn't exist. Before this returns it ensures members are linked so that options may dereference them.

Link copied to clipboard
fun link(sourceProtoFiles: Iterable<ProtoFile>): Schema

Link all features of all files in sourceProtoFiles to create a schema. This will also partially link any imported files necessary.

Link copied to clipboard
fun request(field: Field)

Mark a field as used in an option so its file is retained in the schema.

Link copied to clipboard
fun <T> resolve(name: String, map: Map<String, T>): T?
Link copied to clipboard
Link copied to clipboard

Returns the type name for the relative or fully-qualified name name.

Link copied to clipboard

Returns the type name for the scalar, relative or fully-qualified name name.

Link copied to clipboard
fun validateFields(fields: Iterable<Field>, reserveds: List<Reserved>, syntaxRules: SyntaxRules)

Validate that the tags of fields are unique and in range, that proto3 message cannot reference proto2 enums.

Link copied to clipboard
fun validateImportForPath(location: Location, requiredImport: String)
Link copied to clipboard
Link copied to clipboard
fun withContext(context: Any): Linker

Returns a new linker that uses context to resolve type names and report errors.