MentaContainer

Rev

Rev 20 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 20 Rev 39
1
package org.mentacontainer;
1
package org.mentacontainer;
2
2
3
/**
3
/**
4
 * An IoC component that knows how to create instances of itself and accepts init values for its constructor
4
 * An IoC component that knows how to create instances of itself and accepts init values for its constructor
5
 * and properties to be injected through its setters.
5
 * and properties to be injected through its setters.
6
 *
6
 *
7
 * @author sergio.oliveira.jr@gmail.com
7
 * @author sergio.oliveira.jr@gmail.com
8
 */
8
 */
9
public interface Component {
9
public interface Component {
10
       
10
       
11
        /**
11
        /**
12
         * Instantiate the bean.
12
         * Instantiate the bean.
13
         *
13
         *
14
         * @return The instantiated bean based on the container configuration.
14
         * @return The instantiated bean based on the container configuration.
15
         * @throws InstantiationException
15
         * @throws InstantiationException
16
         */
16
         */
17
        public Object getInstance() throws InstantiationException;
17
        public Object getInstance() throws InstantiationException;
18
       
18
       
19
        /**
19
        /**
20
         * Add a constructor parameter to be used when the bean is instantiated. It can be called more than once to
20
         * Add a constructor parameter to be used when the bean is instantiated. It can be called more than once to
21
         * use constructors with more than one argument.
21
         * use constructors with more than one argument.
22
         *
22
         *
23
         * @param value A parameter value to be used by a constructor.
23
         * @param value A parameter value to be used by a constructor.
24
         * @return The component itself. (Fluent API)
24
         * @return The component itself. (Fluent API)
25
         */
25
         */
26
        public Component addInitValue(Object value);
26
        public Component addInitValue(Object value);
27
       
27
       
28
        /**
28
        /**
29
         * Add a property to be injected through a setter when the component is instantiated.
29
         * Add a property to be injected through a setter when the component is instantiated.
30
         *
30
         *
31
         * @param name The property name.
31
         * @param name The property name.
32
         * @param value The property value.
32
         * @param value The property value.
33
         * @return The component itself. (Fluent API)
33
         * @return The component itself. (Fluent API)
34
         */
34
         */
35
        public Component addProperty(String name, Object value);
35
        public Component addProperty(String name, Object value);
36
       
36
       
37
        /**
37
        /**
38
         * Is this component a singleton component, in other words,
38
         * Is this component a singleton component, in other words,
39
         * it always returns the same instance?
39
         * it always returns the same instance?
40
         *
40
         *
41
         * @return true if it is a singleton component
41
         * @return true if it is a singleton component
42
         */
42
         */
43
        public boolean isSingleton();
43
        public boolean isSingleton();
44
       
-
 
45
        /**
-
 
46
         * What is the name of this component? The name is used when you request an instance from the container.
-
 
47
         *
-
 
48
         * @return The name of this component
-
 
49
         */
-
 
50
        public String getName();
-
 
51
       
-
 
52
}
44
}