01: /*
02: * Copyright 2005 Joe Walker
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: */
16: package org.directwebremoting;
17:
18: import java.util.Collection;
19:
20: /**
21: * A very basic IoC container.
22: * See {@link org.directwebremoting.impl.ContainerUtil} for information on how
23: * to setup a {@link Container}
24: * @see org.directwebremoting.impl.ContainerUtil
25: * @author Joe Walker [joe at getahead dot ltd dot uk]
26: */
27: public interface Container {
28: /**
29: * Get an instance of a bean of a given name (usually name=class name).
30: * @param name The type to get an instance of
31: * @return The object of the given type, or null if the object does not exist
32: */
33: Object getBean(String name);
34:
35: /**
36: * Get an instance of a bean of a given type
37: * @param type The type to get an instance of
38: * @return The object of the given type, or null if the object does not exist
39: */
40: <T> T getBean(Class<T> type);
41:
42: /**
43: * Get a list of all the available beans.
44: * Implementation of this method is optional so it is valid for this method
45: * to return an empty collection, but to return Objects when queried
46: * directly using {@link #getBean(String)}. This method should only be used
47: * for debugging purposes.
48: * @return A collection containing all the availble bean names.
49: */
50: Collection<String> getBeanNames();
51: }
|