File tree Expand file tree Collapse file tree 6 files changed +21
-12
lines changed
main/java/com/iluwatar/dependency/injection
test/java/com/iluwatar/dependency/injection Expand file tree Collapse file tree 6 files changed +21
-12
lines changed Original file line number Diff line number Diff line change 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 */
2727public 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 ();
Original file line number Diff line number Diff line change 22
33/**
44 *
5- * OldTobyTobacco concrete Tobacco implementation
5+ * OldTobyTobacco concrete {@link Tobacco} implementation
66 *
77 */
88public class OldTobyTobacco extends Tobacco {
Original file line number Diff line number Diff line change 22
33/**
44 *
5- * RivendellTobacco concrete Tobacco implementation
5+ * RivendellTobacco concrete {@link Tobacco} implementation
66 *
77 */
88public class RivendellTobacco extends Tobacco {
Original file line number Diff line number Diff line change 22
33/**
44 *
5- * SecondBreakfastTobacco concrete Tobacco implementation
5+ * SecondBreakfastTobacco concrete {@link Tobacco} implementation
66 *
77 */
88public class SecondBreakfastTobacco extends Tobacco {
Original file line number Diff line number Diff line change 44
55/**
66 *
7- * Guice module for binding certain concrete Tobacco implementation.
7+ * Guice module for binding certain concrete {@link Tobacco} implementation.
88 *
99 */
1010public class TobaccoModule extends AbstractModule {
Original file line number Diff line number Diff line change 44
55import com .iluwatar .dependency .injection .App ;
66
7+ /**
8+ *
9+ * Application test
10+ *
11+ */
712public class AppTest {
813
914 @ Test
You can’t perform that action at this time.
0 commit comments