Package-level declarations

Types

Link copied to clipboard
data class AdapterConstant(val javaClassName: ClassName, val kotlinClassName: ClassName, val memberName: String)

A constant field that identifies a ProtoAdapter. This should be a string like like com.squareup.dinosaurs.Dinosaur#ADAPTER with a fully qualified class name, a #, and a field name.

Link copied to clipboard

ClaimedDefinitions tracks handled objects: Types, Services, and Fields. A SchemaHandler is to first check if an object has already been claimed; if yes, it is not to handle it. Otherwise, the SchemaHandler is to handle the object and claim it. It is an error for a SchemaHandler to handle an object which has already been claimed.

Link copied to clipboard

ClaimedPaths tracks generated files' Paths. Schema handlers who generate files are to claim each generated file's path. It is an error to generate different Types or Services to the same file and ClaimedPaths will throw when generation conflicts happen.

Link copied to clipboard
expect object CoreLoader : Loader

A specific Loader which loads Wire's runtime proto files such as google/protobuf/descriptor.proto or wire/extensions.proto.

actual object CoreLoader : Loader
actual object CoreLoader : Loader

A loader that can only load built-in .proto files:

actual object CoreLoader : Loader
Link copied to clipboard

A set of rules that describes which types to generate.

Link copied to clipboard
Link copied to clipboard
data class EnclosingType(val location: Location, val type: ProtoType, val name: String, val documentation: String, val nestedTypes: List<Type>, val nestedExtendList: List<Extend>, val syntax: Syntax) : Type

An empty type which only holds nested types.

Link copied to clipboard
data class EnumConstant(val location: Location, val name: String, val tag: Int, val documentation: String, val options: Options)
Link copied to clipboard
data class EnumType(val type: ProtoType, val location: Location, val documentation: String, val name: String, val constants: List<EnumConstant>, reserveds: List<Reserved>, val options: Options, val syntax: Syntax) : Type
Link copied to clipboard

Collects errors to be reported as a batch. Errors include both a detail message plus context of where they occurred within the schema.

Link copied to clipboard
abstract class EventListener

Listener for metrics events. Extend this class to monitor WireRun and all schema handlers involved in the Protobuf schema manipulation.

Link copied to clipboard
data class Extend(val location: Location, val documentation: String, val name: String, val fields: List<Field>)
Link copied to clipboard
data class Extensions(val location: Location, val documentation: String, val values: List<Any>)
Link copied to clipboard
data class Field(val namespaces: List<String>, val location: Location, val label: Field.Label?, val name: String, val documentation: String, val tag: Int, val default: String?, elementType: String, val options: Options, val isExtension: Boolean, val isOneOf: Boolean, val declaredJsonName: String?)
Link copied to clipboard
data class LinkedOptionEntry(val optionElement: OptionElement, val protoMember: ProtoMember, val value: Any?)
Link copied to clipboard
class Linker

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

Link copied to clipboard
interface Loader

Loads other files as needed by their import path.

Link copied to clipboard
data class Location(val base: String, val path: String, val line: Int = -1, val column: Int = -1)

Locates a .proto file, or a position within a .proto file, on the file system. This includes a base directory or a .jar file, and a path relative to that base.

Link copied to clipboard
class MarkSet(val pruningRules: PruningRules)

A mark set is used in three phases:

Link copied to clipboard
data class MessageType(val type: ProtoType, val location: Location, val documentation: String, val name: String, val declaredFields: List<Field>, val extensionFields: MutableList<Field>, val oneOfs: List<OneOf>, val nestedTypes: List<Type>, val nestedExtendList: List<Extend>, val extensionsList: List<Extensions>, reserveds: List<Reserved>, val options: Options, val syntax: Syntax) : Type
Link copied to clipboard
expect interface Multimap<K, V>
actual interface Multimap<K, V>
actual typealias Multimap<K, V> = com.google.common.collect.Multimap<K, V>
actual interface Multimap<K, V>
Link copied to clipboard
data class OneOf(val name: String, val documentation: String, val fields: List<Field>, val location: Location, val options: Options)
Link copied to clipboard
class Options(optionType: ProtoType, optionElements: List<OptionElement>)

A set of options declared on a message declaration, field declaration, enum declaration, enum constant declaration, service declaration, RPC method declaration, or proto file declaration. Options values may be arbitrary protocol buffer messages, but must be valid protocol buffer messages.

Link copied to clipboard
expect class Profile(profileFiles: List<ProfileFileElement> = emptyList())
actual class Profile(profileFiles: List<ProfileFileElement>)
actual class Profile(profileFiles: List<ProfileFileElement>)

Describes how to map .proto to .java. A single repository of .proto files may have multiple profiles; for example a project may target both Android and Java.

actual class Profile(profileFiles: List<ProfileFileElement>)
Link copied to clipboard
interface ProfileLoader
Link copied to clipboard
data class ProtoFile(val location: Location, val imports: List<String>, val publicImports: List<String>, val packageName: String?, val types: List<Type>, val services: List<Service>, val extendList: List<Extend>, val options: Options, val syntax: Syntax?)
Link copied to clipboard

Identifies a field, enum or RPC on a declaring type. Members are encoded as strings containing a type name, a hash, and a member name, like squareup.dinosaurs.Dinosaur#length_meters.

Link copied to clipboard
class ProtoType

Names a protocol buffer message, enumerated type, service, map, or a scalar. This class models a fully-qualified name using the protocol buffer package.

Link copied to clipboard
class Pruner(schema: Schema, pruningRules: PruningRules)

Creates a new schema that contains only the types selected by the pruning rules, including their transitive dependencies.

Link copied to clipboard

A set of rules that describes which types and members to retain and which to remove.

Link copied to clipboard
data class Reserved(val location: Location, val documentation: String, val values: List<Any>)
Link copied to clipboard
data class Rpc(val location: Location, val name: String, val documentation: String, requestTypeElement: String, responseTypeElement: String, val requestStreaming: Boolean, val responseStreaming: Boolean, val options: Options)
Link copied to clipboard
class Schema

A collection of .proto files that describe a set of messages. A schema is linked: each field's type name is resolved to the corresponding type definition.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
expect class SchemaLoader(fileSystem: FileSystem) : Loader, ProfileLoader

Load proto files and their transitive dependencies and parse them. Keep track of which files were loaded from where so that we can use that information later when deciding what to generate.

actual class SchemaLoader(fileSystem: FileSystem) : Loader, ProfileLoader
actual class SchemaLoader(fileSystem: FileSystem) : Loader, ProfileLoader
actual class SchemaLoader(fileSystem: FileSystem) : Loader, ProfileLoader
Link copied to clipboard
data class Service(val type: ProtoType, val location: Location, val documentation: String, val name: String, val rpcs: List<Rpc>, val options: Options)
Link copied to clipboard
interface SyntaxRules

A set of rules which defines schema requirements for a specific Syntax.

Link copied to clipboard
abstract class Target : Serializable
Link copied to clipboard
sealed class Type
Link copied to clipboard
class WireRun(val sourcePath: List<Location>, val protoPath: List<Location> = listOf(), val treeShakingRoots: List<String> = listOf("*"), val treeShakingRubbish: List<String> = listOf(), val moves: List<TypeMover.Move> = listOf(), val sinceVersion: String? = null, val untilVersion: String? = null, val onlyVersion: String? = null, val targets: List<Target>, val modules: Map<String, WireRun.Module> = emptyMap(), val permitPackageCycles: Boolean = false, val escapeKotlinKeywords: Boolean = false, val eventListeners: List<EventListener> = listOf(), val rejectUnusedRootsOrPrunes: Boolean = true, val opaqueTypes: List<String> = listOf())

An invocation of the Wire compiler. Each invocation performs the following operations:

Properties

Link copied to clipboard

A special base directory used for Wire's built-in .proto files.

Functions

Link copied to clipboard

Returns true if path is bundled in the wire runtime.

Link copied to clipboard
fun newEventListenerFactory(eventListenerFactoryClass: String): EventListener.Factory

Create and return an instance of EventListener.Factory.

Link copied to clipboard
fun newLoggerFactory(loggerFactoryClass: String): WireLogger.Factory

Create and return an instance of WireLogger.Factory.