MentaContainer

Rev

Rev 139 | Rev 143 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 139 Rev 141
Line 10... Line 10...
10
 * It also supports constructor and property values that are dependencies, in other words, they come from the container itself.
10
 * It also supports constructor and property values that are dependencies, in other words, they come from the container itself.
11
 *
11
 *
12
 * @author sergio.oliveira.jr@gmail.com
12
 * @author sergio.oliveira.jr@gmail.com
13
 * @see Interceptor
13
 * @see Interceptor
14
 */
14
 */
15
public interface ConfigurableFactory extends Factory {
-
 
-
 
15
public interface ConfigurableFactory<E> extends Creator<E> {
16
       
16
       
17
        /**
17
        /**
18
         * Add a constructor parameter to be used when the bean is instantiated. It can be called more than once to
18
         * Add a constructor parameter to be used when the bean is instantiated. It can be called more than once to
19
         * use constructors with more than one argument.
19
         * use constructors with more than one argument.
20
         *
20
         *
21
         * @param value A parameter value to be used by a constructor.
21
         * @param value A parameter value to be used by a constructor.
22
         * @return The factory itself. (Fluent API)
22
         * @return The factory itself. (Fluent API)
23
         */
23
         */
24
        public ConfigurableFactory addInitValue(Object value);
-
 
-
 
24
        public ConfigurableFactory<E> addInitValue(Object value);
25
       
25
       
26
        /**
26
        /**
27
         * Add a constructor parameter that is a primitive to be used when the bean is instantiated. It can be called more than once to
27
         * Add a constructor parameter that is a primitive to be used when the bean is instantiated. It can be called more than once to
28
         * use constructors with more than one argument.<br/>
28
         * use constructors with more than one argument.<br/>
29
         * <br/>
29
         * <br/>
Line 33... Line 33...
33
         * </pre>
33
         * </pre>
34
         *
34
         *
35
         * @param value A parameter value to be used by a constructor. Must be a primitive that will be autoboxed.
35
         * @param value A parameter value to be used by a constructor. Must be a primitive that will be autoboxed.
36
         * @return The factory itself. (Fluent API)
36
         * @return The factory itself. (Fluent API)
37
         */
37
         */
38
        public ConfigurableFactory addInitPrimitive(Object value);
-
 
-
 
38
        public ConfigurableFactory<E> addInitPrimitive(Object value);
39
       
39
       
40
       
40
       
41
        /**
41
        /**
42
         * Add a constructor parameter that is a dependency, in other words, it gets its value from the container.
42
         * Add a constructor parameter that is a dependency, in other words, it gets its value from the container.
43
         * When the object is created the dependency will be obtained from the container.
43
         * When the object is created the dependency will be obtained from the container.
44
         *
44
         *
45
         * @param key The key used to get an instance from the container
45
         * @param key The key used to get an instance from the container
46
         * @return The factory itself. (Fluent API)
46
         * @return The factory itself. (Fluent API)
47
         */
47
         */
48
        public ConfigurableFactory addConstructorDependency(Object key);
-
 
-
 
48
        public ConfigurableFactory<E> addConstructorDependency(Object key);
49
       
49
       
50
        /**
50
        /**
51
         * In case you want to force the use of a zero argument constructor and avoid any ambiguity when choosing the constructor to use.
51
         * In case you want to force the use of a zero argument constructor and avoid any ambiguity when choosing the constructor to use.
52
         *
52
         *
53
         * This method is seldom necessary and should be used in the rare cases that the container cannot correctly determine the constructor you
53
         * This method is seldom necessary and should be used in the rare cases that the container cannot correctly determine the constructor you
54
         * want to use due to auto-wiring.
54
         * want to use due to auto-wiring.
55
         *
55
         *
56
         * @return The factory itself. (Fluent API)
56
         * @return The factory itself. (Fluent API)
57
         */
57
         */
58
        public ConfigurableFactory useZeroArgumentConstructor();
-
 
-
 
58
        public ConfigurableFactory<E> useZeroArgumentConstructor();
59
       
59
       
60
        /**
60
        /**
61
         * Add a property to be injected through a setter when the factory instantiates an object.
61
         * Add a property to be injected through a setter when the factory instantiates an object.
62
         *
62
         *
63
         * @param name The property name.
63
         * @param name The property name.
64
         * @param value The property value.
64
         * @param value The property value.
65
         * @return The factory itself. (Fluent API)
65
         * @return The factory itself. (Fluent API)
66
         */
66
         */
67
        public ConfigurableFactory addPropertyValue(String name, Object value);
-
 
-
 
67
        public ConfigurableFactory<E> addPropertyValue(String name, Object value);
68
       
68
       
69
        /**
69
        /**
70
         * Add a setter property that is a dependency, in other words, its value will be obtained from the container.
70
         * Add a setter property that is a dependency, in other words, its value will be obtained from the container.
71
         *
71
         *
72
         * The property name and the dependency name are the same. If they are different you can use the other version of addPropertyDependency that accepts both values.
72
         * The property name and the dependency name are the same. If they are different you can use the other version of addPropertyDependency that accepts both values.
73
         *
73
         *
74
         * @param property The dependency name which is equal to the property name.
74
         * @param property The dependency name which is equal to the property name.
75
         * @return The factory itself. (Fluent API)
75
         * @return The factory itself. (Fluent API)
76
         */
76
         */
77
        public ConfigurableFactory addPropertyDependency(String property);
-
 
-
 
77
        public ConfigurableFactory<E> addPropertyDependency(String property);
78
       
78
       
79
        /**
79
        /**
80
         * Add a setter property that is a dependency, in other words, its value will be obtained from the container.
80
         * Add a setter property that is a dependency, in other words, its value will be obtained from the container.
81
         *
81
         *
82
         * The property name and the dependency name are different.
82
         * The property name and the dependency name are different.
83
         *
83
         *
84
         * @param property The property that will be injected by the container.
84
         * @param property The property that will be injected by the container.
85
         * @param key The dependency name, in other words, the key used to get a bean from the container.
85
         * @param key The dependency name, in other words, the key used to get a bean from the container.
86
         * @return The factory itself. (Fluent API)
86
         * @return The factory itself. (Fluent API)
87
         */
87
         */
88
        public ConfigurableFactory addPropertyDependency(String property, Object key);
-
 
-
 
88
        public ConfigurableFactory<E> addPropertyDependency(String property, Object key);
89
}
89
}