Permalink
Browse files

updated readme with meta class binding documentation

  • Loading branch information...
1 parent b82d334 commit 6023c1e311addc5a9617ce63549117e070dc26ac @thestoics thestoics committed Mar 8, 2011
Showing with 27 additions and 0 deletions.
  1. +27 −0 README.md
View
@@ -86,6 +86,33 @@ Objection supports associating an object outside the context of Objection by con
[Objection setGlobalInjector:injector];
}
+### Meta Class Bindings
+
+There are times when a dependency -- usually external -- is implemented only using class methods. Objection can support explicitly binding to
+the meta class instance through a protocol. This avoids having to unnecessarily create a wrapper class that passes through to the class
+methods. The disadvantage, of course, is that it requires a protocol definition so that Objection knows how to bind the meta class to objects
+in the injector context.
+
+### Example
+
+ @protocol ExternalUtility
+ - (void)doSomething;
+ @end
+
+ @interface ExternalUtility
+ + (void)doSomething;
+ @end
+
+ @implementation ExternalUtility
+ + (void)doSomething {...}
+ @end
+
+ // Module Configuration
+ - (void)configure {
+ [self bindMetaClass:[ExternalUtility class] toProtocol:@protocol(ExternalUtility)];
+ }
+
+
### Instance Creation Notification
If an object is interested in knowing when it has been fully instantiated by objection it can implement the method

0 comments on commit 6023c1e

Please sign in to comment.