This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: lmajano on Jul 26th, 2012  |  syntax: Java  |  size: 0.54 KB  |  views: 18  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  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. }
clone this paste RAW Paste Data