All Classes Files Functions Variables Typedefs Enumerations Enumerator Properties Macros Groups Pages
<TyphoonComponentFactory> Protocol Reference

Defines a protocol for resolving built instances, injecting a pre-obtained instance using a factory containing definitions from one or more TyphoonAssembly classes. More...

Inheritance diagram for <TyphoonComponentFactory>:

Instance Methods

(NSArray *) - allComponentsForType:
 Returns an array objects matching the given type. More...
 
(void) - attachPostProcessor:
 Attach a TyphoonComponentFactoryPostProcessor to this component factory. More...
 
(id) - componentForKey:
 Returns the component matching the given key. More...
 
(id) - componentForKey:args:
 
(id) - componentForType:
 Returns an an instance of the component matching the supplied class or protocol. More...
 
(void) - inject:
 Injects the properties and methods of an object. More...
 
(void) - inject:withSelector:
 Injects the properties and methods of an object, described in definition. More...
 
(void) - makeDefault
 

Detailed Description

Defines a protocol for resolving built instances, injecting a pre-obtained instance using a factory containing definitions from one or more TyphoonAssembly classes.

Method Documentation

- (NSArray *) allComponentsForType: (id)  classOrProtocol

Returns an array objects matching the given type.

See also
componentForType
- (void) attachPostProcessor: (id< TyphoonDefinitionPostProcessor >)  postProcessor

Attach a TyphoonComponentFactoryPostProcessor to this component factory.

Parameters
postProcessorThe post-processor to attach.
- (id) componentForKey: (NSString *)  key

Returns the component matching the given key.

For the block-style, this is the name of the method on the TyphoonAssembly interface, although, for block-style you'd typically use the assembly interface itself for component resolution.

- (id) componentForKey: (NSString *)  key
args: (TyphoonRuntimeArguments *)  args 
- (id) componentForType: (id)  classOrProtocol

Returns an an instance of the component matching the supplied class or protocol.

For example:

[factory objectForType:[Knight class]];
[factory objectForType:@protocol(Quest)];
Exceptions
NSInvalidArgumentExceptionWhen no singletons or prototypes match the requested type.
NSInvalidArgumentExceptionWhen when more than one singleton or prototype matches the requested type.
Warning
componentForType with a protocol argument is not currently supported in Objective-C++.
See also
: - allComponentsForType:
- (void) inject: (id)  instance

Injects the properties and methods of an object.

- (void) inject: (id)  instance
withSelector: (SEL)  selector 

Injects the properties and methods of an object, described in definition.

- (void) makeDefault