wire-profiles / com.squareup.wire.java.internal / ProfileFileElement

ProfileFileElement

data class ProfileFileElement

A single .wire file. This file is structured similarly to a .proto file, but with different elements.

File Structure

A project may have 0 or more .wire files. These files should be in the same directory as the .proto files so they may be automatically discovered by Wire.

Each file starts with a syntax declaration. The syntax must be "wire2". This is followed by an optional package declaration, which should match to the package declarations of the .proto files in the directory.

Profiles may import any number of proto files. Note that it is an error to import .wire files. These imports are used to resolve types specified later in the file.

Profiles may specify any number of type configurations. These specify a fully qualified type, its target Java type, and an adapter to do the encoding and decoding.

syntax = "wire2";
package squareup.dinosaurs;

import "squareup/geology/period.proto";

// Roar!
type squareup.dinosaurs.Dinosaur {
target com.squareup.dino.Dinosaur using com.squareup.dino.Dinosaurs#DINO_ADAPTER;
}

Constructors

<init>

ProfileFileElement(location: Location, packageName: String? = null, imports: List<String> = emptyList(), typeConfigs: List<TypeConfigElement> = emptyList())

A single .wire file. This file is structured similarly to a .proto file, but with different elements.

Properties

imports

val imports: List<String>

location

val location: Location

packageName

val packageName: String?

typeConfigs

val typeConfigs: List<TypeConfigElement>

Functions

toSchema

fun toSchema(): <ERROR CLASS>