MentaContainer

Rev

Rev 39 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
20 soliveira 1
package org.mentacontainer;
2
 
3
/**
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.
6
 *
7
 * @author sergio.oliveira.jr@gmail.com
8
 */
9
public interface Component {
10
 
11
        /**
12
         * Instantiate the bean.
13
         *
14
         * @return The instantiated bean based on the container configuration.
15
         */
40 soliveira 16
        public Object getInstance();
20 soliveira 17
 
18
        /**
19
         * Add a constructor parameter to be used when the bean is instantiated. It can be called more than once to
20
         * use constructors with more than one argument.
21
         *
22
         * @param value A parameter value to be used by a constructor.
23
         * @return The component itself. (Fluent API)
24
         */
25
        public Component addInitValue(Object value);
26
 
27
        /**
28
         * Add a property to be injected through a setter when the component is instantiated.
29
         *
30
         * @param name The property name.
31
         * @param value The property value.
32
         * @return The component itself. (Fluent API)
33
         */
34
        public Component addProperty(String name, Object value);
35
 
36
        /**
37
         * Is this component a singleton component, in other words,
38
         * it always returns the same instance?
39
         *
40
         * @return true if it is a singleton component
41
         */
42
        public boolean isSingleton();
43
}