Advertisement
lmajano

Untitled

Jul 26th, 2012
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.54 KB | None | 0 0
  1. // Map Binder so you can do utility methods
  2. map("myBinder").toValue( this );
  3. // Map the singleton maps
  4. map("s1Map").toFactoryMethod("myBinder", "buildMap")
  5.     .methodArg(name="mapType", value="1");
  6.  
  7.  
  8. // Map A service with a singleton map
  9. map("Service").to("path")
  10.     .initArg(name="myMap", ref="s1Map");
  11.  
  12.  
  13. // Utility method to build singleton maps
  14. function buildMap(mapType){
  15.     switch( arguments.mapType ){
  16.         case 1 : {
  17.             return {
  18.                 s1 = getInjector().getInstance('s1'),
  19.                 s2 = getInjector().getInstance('s2')
  20.             };
  21.         }
  22.     }
  23.  
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement