All Classes Files Functions Variables Typedefs Enumerations Enumerator Properties Macros Groups Pages
TyphoonComponentFactory Class Reference

This is the base class for all component factories. More...

Inheritance diagram for TyphoonComponentFactory:

Properties

NSArray * definitionPostProcessors
 The attached factory post processors. More...
 
NSArray * instancePostProcessors
 The attached component post processors. More...
 
BOOL loaded
 Say if the factory has been loaded. More...
 
NSArray * singletons
 The instantiated singletons. More...
 

Class Methods

(id) + defaultFactory
 Returns the default component factory, if one has been set. More...
 
(TyphoonComponentFactory *) + factoryForResolvingFromXibs
 Factory used to resolve definition from TyphoonLoadedView. More...
 
(void) + setFactoryForResolvingFromXibs:
 

Instance Methods

(void) - enumerateDefinitions:
 
(void) - load
 Mutate the component definitions and build the not-lazy singletons. More...
 
(void) - registerDefinition:
 Registers a component into the factory. More...
 
(NSArray *) - registry
 
(void) - unload
 Dump all the singletons. More...
 
- Instance Methods inherited from <TyphoonComponentFactory>
(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

This is the base class for all component factories.

It defines methods for retrieving components from the factory, as well as a low-level API for assembling components from their constituent parts. This low-level API could be used as-is, however its intended to use a higher level abstraction such as TyphoonBlockComponentFactory.

Property Documentation

- (NSArray*) definitionPostProcessors
readnonatomicstrong

The attached factory post processors.

- (NSArray*) instancePostProcessors
readnonatomicstrong

The attached component post processors.

- (BOOL) loaded
readwritenonatomicassign

Say if the factory has been loaded.

- (NSArray*) singletons
readnonatomicstrong

The instantiated singletons.

Method Documentation

+ (id) defaultFactory

Returns the default component factory, if one has been set.

See also
[TyphoonComponentFactory - makeDefault (TyphoonComponentFactory-p)]. This allows resolving components from the Typhoon another class after the container has been set up.

A more desirable approach, if possible - especially for a component that is also registered with the container is to use TyphoonComponentFactoryAware, which injects the component factory as a dependency on the class that needs it. This latter approach simplifies unit testing, in that no special approach to patching out the classes collaborators is required.

See also
[TyphoonComponentFactory - makeDefault (TyphoonComponentFactory-p)].
TyphoonComponentFactoryAware
- (void) enumerateDefinitions: (void(^)(TyphoonDefinition *definition, NSUInteger index, TyphoonDefinition **definitionToReplace, BOOL *stop))  block
+ (TyphoonComponentFactory *) factoryForResolvingFromXibs

Factory used to resolve definition from TyphoonLoadedView.

- (void) load

Mutate the component definitions and build the not-lazy singletons.

- (void) registerDefinition: (TyphoonDefinition *)  definition

Registers a component into the factory.

Components can be declared in any order, the container will work out how to resolve them.

- (NSArray *) registry
+ (void) setFactoryForResolvingFromXibs: (TyphoonComponentFactory *)  factory
- (void) unload

Dump all the singletons.