CommandMappingsBuilder

Extends Mappings with type-safe command and destination overloads for CommandDispatcher-based dispatcher modules.

Subclasses supply concrete command type C and destination type D, giving callers enum-based safety for both. All base Mappings methods remain available via delegation.

Example:

class MyMappings : CommandMappingsBuilder<MyCommand, MyDestination>()

Constructors

Link copied to clipboard
constructor(delegate: Mappings = Mappings.default())

Functions

Link copied to clipboard
open override fun build(): List<MappingOperation>

Builds and returns the list of mapping TransformationOperations that have been configured.

Link copied to clipboard

Keeps a typed destination path unchanged (source == destination).

open override fun keep(path: JsonObjectPath): Mappings.VariableOptions

Adds a mapping where the possibly nested path is both the source and destination of the mapping.

open override fun keep(key: String): Mappings.VariableOptions

Adds a mapping where the key is both the source and destination of the mapping.

Link copied to clipboard
open override fun mapCommand(name: String): Mappings.CommandOptions

Adds a mapping where the value to map is given by the constant name and will be mapped to a fixed destination of Dispatch.Keys.COMMAND_NAME.

Link copied to clipboard

Maps a constant value to a typed destination path.

open override fun mapConstant(value: DataItem, destination: JsonObjectPath): Mappings.ConstantOptions

Adds a mapping where the value to map is given by the constant value and will be mapped to the given destination located/stored at some configured level of nesting as defined by the JsonObjectPath.

open override fun mapConstant(value: DataItem, destination: String): Mappings.ConstantOptions

Adds a mapping where the value to map is given by the constant value and will be mapped to the given destination

Link copied to clipboard

Maps a nested path to a typed destination path.

Maps a payload key to a typed destination path.

open override fun mapFrom(path: JsonObjectPath, destination: JsonObjectPath): Mappings.VariableOptions

Adds a mapping where both the path and destination can be located/stored at some configured level of nesting as defined by the JsonObjectPath for each input.

open override fun mapFrom(path: JsonObjectPath, destination: String): Mappings.VariableOptions

Adds a mapping where the destination is to be in the top level of the mapped payload, but the source key is defined at some nested object/list as defined by path.

open override fun mapFrom(key: String, destination: JsonObjectPath): Mappings.VariableOptions

Adds a mapping where the key is to be found in the top level of the input payload, but the destination key is to be defined at some nested object/list as defined by destination.

open override fun mapFrom(key: String, destination: String): Mappings.VariableOptions

Adds a mapping where the key and destination are in the top level of the payload.

Link copied to clipboard
open override fun path(root: String): JsonObjectPath

Utility method to start creating JsonObjectPaths. This method is shorthand for JsonPath.root