1.1 --- a/samples/componentinjection/nbproject/project.properties Sat Jun 14 09:53:42 2008 +0200
1.2 +++ b/samples/componentinjection/nbproject/project.properties Sat Jun 14 09:53:43 2008 +0200
1.3 @@ -17,9 +17,11 @@
1.4 dist.javadoc.dir=${dist.dir}/javadoc
1.5 excludes=
1.6 file.reference.junit-4.4.jar=../libs/dist/junit-4.4.jar
1.7 +file.reference.org-openide-util.jar=../libs/dist/org-openide-util.jar
1.8 includes=**
1.9 jar.compress=false
1.10 -javac.classpath=
1.11 +javac.classpath=\
1.12 + ${file.reference.org-openide-util.jar}
1.13 # Space-separated list of extra javac options
1.14 javac.compilerargs=
1.15 javac.deprecation=false
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2.2 +++ b/samples/componentinjection/src/org/apidesign/component/DefineInjectionSlot.java Sat Jun 14 09:53:43 2008 +0200
2.3 @@ -0,0 +1,23 @@
2.4 +package org.apidesign.component;
2.5 +
2.6 +import java.util.Collection;
2.7 +import org.openide.util.Lookup;
2.8 +
2.9 +public class DefineInjectionSlot {
2.10 + private DefineInjectionSlot() {
2.11 + }
2.12 +
2.13 + // BEGIN: lookup.define.slot
2.14 + public static <T> T singleSlot(Class<T> clazz) {
2.15 + // get one implementation
2.16 + T instance = Lookup.getDefault().lookup(clazz);
2.17 + return instance;
2.18 + }
2.19 +
2.20 + public static <T> Collection<? extends T> multiSlot(Class<T> clazz) {
2.21 + // get all registered implementations
2.22 + Collection<? extends T> all = Lookup.getDefault().lookupAll(clazz);
2.23 + return all;
2.24 + }
2.25 + // END: lookup.define.slot
2.26 +}