SHOW:
|
|
- or go back to the newest paste.
1 | - | // Map Binder so you can do utility methods |
1 | + | component |
2 | - | map("myBinder").toValue( this ); |
2 | + | { |
3 | - | // Map the singleton maps |
3 | + | struct function buildStruct() { |
4 | - | map("s1Map").toFactoryMethod("myBinder", "buildMap") |
4 | + | return arguments; |
5 | - | .methodArg(name="mapType", value="1"); |
5 | + | } |
6 | ||
7 | array function buildArray() { | |
8 | - | // Map A service with a singleton map |
8 | + | var array = []; |
9 | - | map("Service").to("path") |
9 | + | |
10 | - | .initArg(name="myMap", ref="s1Map"); |
10 | + | for (var index = 1; index <= arrayLen(arguments); index++) |
11 | array[index] = arguments[index]; | |
12 | ||
13 | - | // Utility method to build singleton maps |
13 | + | return array; |
14 | - | function buildMap(mapType){ |
14 | + | } |
15 | - | switch( arguments.mapType ){ |
15 | + | } |
16 | - | case 1 : { |
16 | + | |
17 | - | return { |
17 | + | |
18 | - | s1 = getInjector().getInstance('s1'), |
18 | + | map("Factory") |
19 | - | s2 = getInjector().getInstance('s2') |
19 | + | .to("com.util.wirebox.Factory") |
20 | - | }; |
20 | + | .asSingleton() |
21 | - | } |
21 | + | .noAutowire(); |
22 | - | } |
22 | + | |
23 | map("something") | |
24 | - | } |
24 | + | .toFactoryMethod(factory="Factory", method="buildStruct") |
25 | .methodArg(name="apple", ref="apple") | |
26 | .methodArg(name="banana", ref="banana"); | |
27 | ||
28 | map("Foo") | |
29 | .to("com.Foo") | |
30 | .initArg(name="something", ref="something") | |
31 | .asSingleton(); |