]> git.somenet.org - pub/jan/dst18.git/blob - ass2-di/src/main/java/dst/ass2/di/IInjectionController.java
Add template for assignment 2
[pub/jan/dst18.git] / ass2-di / src / main / java / dst / ass2 / di / IInjectionController.java
1 package dst.ass2.di;
2
3 /**
4  * The dependency injection controller interface.
5  */
6 public interface IInjectionController {
7
8     /**
9      * Injects all fields annotated with {@link dst.ass2.di.annotation.Inject @Inject}.<br/>
10      * Only objects of classes annotated with {@link dst.ass2.di.annotation.Component @Component} shall be accepted.
11      *
12      * @param obj the object to initialize.
13      * @throws InjectionException if it's no component or dependency injection fails.
14      */
15     void initialize(Object obj) throws InjectionException;
16
17     /**
18      * Gets the fully initialized instance of a singleton component.<br/>
19      * Multiple calls of this method always have to return the same instance.
20      * Only classes that are annotated with {@link dst.ass2.di.annotation.Component Component} shall be accepted.
21      *
22      * @param <T> the class type.
23      * @param clazz the class of the component.
24      * @return the initialized singleton object.
25      * @throws InjectionException if it's no component or dependency injection fails.
26      */
27     <T> T getSingletonInstance(Class<T> clazz) throws InjectionException;
28 }