X Tutup
Skip to content

Commit e71f227

Browse files
committed
iluwatar#107 Dependency Injection example JavaDoc
1 parent 10a911b commit e71f227

File tree

6 files changed

+21
-12
lines changed

6 files changed

+21
-12
lines changed

dependency-injection/src/main/java/com/iluwatar/dependency/injection/App.java

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,27 @@
99
* implements so called inversion of control principle. Inversion of control has two specific rules:
1010
* - High-level modules should not depend on low-level modules. Both should depend on abstractions.
1111
* - Abstractions should not depend on details. Details should depend on abstractions.
12-
*
13-
* In this example we show you three different wizards. The first one (SimpleWizard) is a naive
12+
* <p>
13+
* In this example we show you three different wizards. The first one ({@link SimpleWizard}) is a naive
1414
* implementation violating the inversion of control principle. It depends directly on a concrete
1515
* implementation which cannot be changed.
16-
*
17-
* The second wizard (AdvancedWizard) is more flexible. It does not depend on any concrete implementation
18-
* but abstraction. It utilizes Dependency Injection pattern allowing its Tobacco dependency to be
16+
* <p>
17+
* The second wizard ({@link AdvancedWizard}) is more flexible. It does not depend on any concrete implementation
18+
* but abstraction. It utilizes Dependency Injection pattern allowing its {@link Tobacco} dependency to be
1919
* injected through its constructor. This way, handling the dependency is no longer the wizard's
2020
* responsibility. It is resolved outside the wizard class.
21-
*
21+
* <p>
2222
* The third example takes the pattern a step further. It uses Guice framework for Dependency Injection.
23-
* TobaccoModule binds a concrete implementation to abstraction. Injector is then used to create
24-
* GuiceWizard object with correct dependencies.
23+
* {@link TobaccoModule} binds a concrete implementation to abstraction. Injector is then used to create
24+
* {@link GuiceWizard} object with correct dependencies.
2525
*
2626
*/
2727
public class App {
2828

29+
/**
30+
* Program entry point
31+
* @param args command line args
32+
*/
2933
public static void main( String[] args ) {
3034
SimpleWizard simpleWizard = new SimpleWizard();
3135
simpleWizard.smoke();

dependency-injection/src/main/java/com/iluwatar/dependency/injection/OldTobyTobacco.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
/**
44
*
5-
* OldTobyTobacco concrete Tobacco implementation
5+
* OldTobyTobacco concrete {@link Tobacco} implementation
66
*
77
*/
88
public class OldTobyTobacco extends Tobacco {

dependency-injection/src/main/java/com/iluwatar/dependency/injection/RivendellTobacco.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
/**
44
*
5-
* RivendellTobacco concrete Tobacco implementation
5+
* RivendellTobacco concrete {@link Tobacco} implementation
66
*
77
*/
88
public class RivendellTobacco extends Tobacco {

dependency-injection/src/main/java/com/iluwatar/dependency/injection/SecondBreakfastTobacco.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
/**
44
*
5-
* SecondBreakfastTobacco concrete Tobacco implementation
5+
* SecondBreakfastTobacco concrete {@link Tobacco} implementation
66
*
77
*/
88
public class SecondBreakfastTobacco extends Tobacco {

dependency-injection/src/main/java/com/iluwatar/dependency/injection/TobaccoModule.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
/**
66
*
7-
* Guice module for binding certain concrete Tobacco implementation.
7+
* Guice module for binding certain concrete {@link Tobacco} implementation.
88
*
99
*/
1010
public class TobaccoModule extends AbstractModule {

dependency-injection/src/test/java/com/iluwatar/dependency/injection/AppTest.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@
44

55
import com.iluwatar.dependency.injection.App;
66

7+
/**
8+
*
9+
* Application test
10+
*
11+
*/
712
public class AppTest {
813

914
@Test

0 commit comments

Comments
 (0)
X Tutup