Rev 39 | Go to most recent revision | Details | 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 | * @throws InstantiationException |
||
16 | */ |
||
17 | public Object getInstance() throws InstantiationException; |
||
18 | |||
19 | /** |
||
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. |
||
22 | * |
||
23 | * @param value A parameter value to be used by a constructor. |
||
24 | * @return The component itself. (Fluent API) |
||
25 | */ |
||
26 | public Component addInitValue(Object value); |
||
27 | |||
28 | /** |
||
29 | * Add a property to be injected through a setter when the component is instantiated. |
||
30 | * |
||
31 | * @param name The property name. |
||
32 | * @param value The property value. |
||
33 | * @return The component itself. (Fluent API) |
||
34 | */ |
||
35 | public Component addProperty(String name, Object value); |
||
36 | |||
37 | /** |
||
38 | * Is this component a singleton component, in other words, |
||
39 | * it always returns the same instance? |
||
40 | * |
||
41 | * @return true if it is a singleton component |
||
42 | */ |
||
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 | } |