import { IClass } from "../../matching/IClass" ; import { ICommand } from "../api/ICommand" ; import { ICommandMapping } from "../api/ICommandMapping" ; import { ICommandMappingList } from "../api/ICommandMappingList" ; import { ICommandMapper } from "../dsl/ICommandMapper" ; import { ICommandUnmapper } from "../dsl/ICommandUnmapper" ; import { ICommandConfigurator } from "../dsl/ICommandConfigurator" ; import { CommandMapping } from "./CommandMapping" ; private export class CommandMapper implements ICommandMapper , ICommandUnmapper , ICommandConfigurator { private _mappings : ICommandMappingList ; private _mapping : ICommandMapping ; param mappings constructor ( mappings ) { this . _mappings = mappings ; } inheritDoc public toCommand ( commandClass ) { this . _mapping = new CommandMapping ( commandClass ) ; this . _mappings . addMapping ( this . _mapping ) ; return this ; } inheritDoc public fromCommand ( commandClass ) { this . _mappings . removeMappingFor ( commandClass ) ; } inheritDoc public fromAll ( ) { this . _mappings . removeAllMappings ( ) ; } inheritDoc public once ( value = true ) { this . _mapping . setFireOnce ( value ) ; return this ; } inheritDoc public withGuards ( ... guards ) { this . _mapping . addGuards ( ... guards ) ; return this ; } inheritDoc public withHooks ( ... hooks ) { this . _mapping . addHooks ( ... hooks ) ; return this ; } inheritDoc public withPayloadInjection ( value = true ) { this . _mapping . setPayloadInjectionEnabled ( value ) ; return this ; } }