C# Class Command.Registry

Provides a registry of discovered Commands and Factories, as well as methods for discovering them.
ファイルを表示 Open project: agardiner/hfmcmd Class Usage Examples

Protected Properties

Property Type Description
_alternates List
_log log4net.ILog

Public Methods

Method Description
Add ( Command cmd ) : void

Registers the specified Command instance.

Add ( Factory factory ) : void

Registers the specified Factory instance as an alternate mechanism for obtaining objects of the Factory return type. An alternate means will be tried when no other non-alternate path to create an object can be found from the current context state.

Commands ( ) : IEnumerable

Returns each Command that is currently registered.

Contains ( Type type ) : bool

Checks to see if a Factory for the specified type is available.

Contains ( string cmdName ) : bool

Checks to see if a command with the given name is available.

GetAlternates ( Type type ) : IEnumerable

Returns an IEnumerable of the alternate Factory objects registered for the specified type.

GetFactory ( Type type ) : Factory

Returns the Factory instance for objects of the specified Type.

GetSettings ( Type type ) : List

Returns a list of the settings an ISettingsCollection instance holds.

RegisterClass ( Type t ) : void

Registers commands and factories from the supplied class. Commands must be tagged with the attribute Command to be locatable.

RegisterNamespace ( Assembly asm, string ns ) : void

Registers commands from the supplied assembly. Commands methods must be tagged with the attribute Command to be locatable.

RegisterNamespace ( string ns ) : void

Registers commands (i.e. methods tagged with the Command attribute) in the current assembly.

Registry ( ) : System
this ( string cmdName ) : Command

Method Details

Add() public method

Registers the specified Command instance.
public Add ( Command cmd ) : void
cmd Command
return void

Add() public method

Registers the specified Factory instance as an alternate mechanism for obtaining objects of the Factory return type. An alternate means will be tried when no other non-alternate path to create an object can be found from the current context state.
public Add ( Factory factory ) : void
factory Factory
return void

Commands() public method

Returns each Command that is currently registered.
public Commands ( ) : IEnumerable
return IEnumerable

Contains() public method

Checks to see if a Factory for the specified type is available.
public Contains ( Type type ) : bool
type System.Type
return bool

Contains() public method

Checks to see if a command with the given name is available.
public Contains ( string cmdName ) : bool
cmdName string
return bool

GetAlternates() public method

Returns an IEnumerable of the alternate Factory objects registered for the specified type.
public GetAlternates ( Type type ) : IEnumerable
type System.Type
return IEnumerable

GetFactory() public method

Returns the Factory instance for objects of the specified Type.
public GetFactory ( Type type ) : Factory
type System.Type
return Factory

GetSettings() public method

Returns a list of the settings an ISettingsCollection instance holds.
public GetSettings ( Type type ) : List
type System.Type
return List

RegisterClass() public method

Registers commands and factories from the supplied class. Commands must be tagged with the attribute Command to be locatable.
public RegisterClass ( Type t ) : void
t System.Type
return void

RegisterNamespace() public method

Registers commands from the supplied assembly. Commands methods must be tagged with the attribute Command to be locatable.
public RegisterNamespace ( Assembly asm, string ns ) : void
asm System.Reflection.Assembly
ns string
return void

RegisterNamespace() public method

Registers commands (i.e. methods tagged with the Command attribute) in the current assembly.
public RegisterNamespace ( string ns ) : void
ns string
return void

Registry() public method

public Registry ( ) : System
return System

this() public method

public this ( string cmdName ) : Command
cmdName string
return Command

Property Details

_alternates protected_oe property

protected List _alternates
return List

_log protected_oe static_oe property

protected static ILog,log4net _log
return log4net.ILog