SchemaHandler

Constructors

Link copied to clipboard
constructor()

Types

Link copied to clipboard
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.

Link copied to clipboard
interface Factory : Serializable

Implementations of this interface must have a no-arguments public constructor.

Link copied to clipboard
data class Module(val name: String, val types: Set<ProtoType>, val upstreamTypes: Map<ProtoType, String> = mapOf())

A Module dictates how the loaded types are to be partitioned and handled.

Functions

Link copied to clipboard
open fun handle(schema: Schema, context: SchemaHandler.Context)

This will handle all ProtoFiles which are part of the sourcePath. If a Module is set in the context, it will handle only Types and Services the module defines respecting the context rules. Override this method if you have specific needs the default implementation doesn't address.

abstract fun handle(service: Service, context: SchemaHandler.Context): List<Path>

Returns the Paths of the files which service will have been generated into. Null if nothing has been generated.

abstract fun handle(type: Type, context: SchemaHandler.Context): Path?

Returns the Path of the file which type will have been generated into. Null if nothing has been generated.

abstract fun handle(extend: Extend, field: Field, context: SchemaHandler.Context): Path?

Returns the Path of the files which field will have been generated into. Null if nothing has been generated.