Context

data class Context(val fileSystem: FileSystem, val outDirectory: Path, val logger: WireLogger, val errorCollector: ErrorCollector = ErrorCollector(), val emittingRules: EmittingRules = EmittingRules(), val claimedDefinitions: ClaimedDefinitions? = null, val claimedPaths: ClaimedPaths = ClaimedPaths(), val module: SchemaHandler.Module? = null, val sourcePathPaths: Set<String>? = null, val profileLoader: ProfileLoader? = null)

A Context holds the information necessary for a SchemaHandler to do its job. It contains both helping objects such as logger, and constraining objects such as emittingRules.

Constructors

Link copied to clipboard
constructor(fileSystem: FileSystem, outDirectory: Path, logger: WireLogger, errorCollector: ErrorCollector = ErrorCollector(), emittingRules: EmittingRules = EmittingRules(), claimedDefinitions: ClaimedDefinitions? = null, claimedPaths: ClaimedPaths = ClaimedPaths(), module: SchemaHandler.Module? = null, sourcePathPaths: Set<String>? = null, profileLoader: ProfileLoader? = null)

Properties

Link copied to clipboard

If set, the SchemaHandler is to handle only types which are not claimed yet, and claim itself types it has handled. If null, the SchemaHandler is to handle all types.

Link copied to clipboard

If the SchemaHandler writes files, it is to claim Paths of files it created.

Link copied to clipboard

Set of rules letting the SchemaHandler know what ProtoType to include or exclude in its logic. This object represents the includes and excludes values which were associated with its Target.

Link copied to clipboard

Object to be used by the SchemaHandler to store errors. After all SchemaHandlers are finished, Wire will throw an exception if any error are present inside the collector.

Link copied to clipboard
val fileSystem: FileSystem

To be used by the SchemaHandler for reading/writing operations on disk.

Link copied to clipboard

Event-listener like logger with which SchemaHandler can notify handled artifacts.

Link copied to clipboard

A Module dictates how the loaded types are partitioned and how they are to be handled. If null, there are no partition and all types are to be handled.

Link copied to clipboard
val outDirectory: Path

Location on fileSystem where the SchemaHandler is to write files, if it needs to.

Link copied to clipboard

To be used by the SchemaHandler if it supports Profile files. Please note that this API is unstable and can change at anytime.

Link copied to clipboard
val sourcePathPaths: Set<String>? = null

Contains Location.path values of all sourcePath roots. The SchemaHandler is to ignore ProtoFiles not part of this set; this verification can be executed via the inSourcePath method.

Functions

Link copied to clipboard
fun inSourcePath(location: Location): Boolean

True if this location ia part of a sourcePath root.

fun inSourcePath(protoFile: ProtoFile): Boolean

True if this protoFile ia part of a sourcePath root.