2015-07-24 11:32:22 +03:00
|
|
|
package com.iluwatar.dependency.injection;
|
2015-05-22 23:37:42 +03:00
|
|
|
|
2015-05-25 19:13:50 +03:00
|
|
|
/**
|
|
|
|
*
|
2015-11-01 18:48:43 -05:00
|
|
|
* AdvancedWizard implements inversion of control. It depends on abstraction that can be injected
|
|
|
|
* through its constructor.
|
2015-05-25 19:13:50 +03:00
|
|
|
*
|
|
|
|
*/
|
2015-05-22 23:37:42 +03:00
|
|
|
public class AdvancedWizard implements Wizard {
|
|
|
|
|
2015-11-01 18:48:43 -05:00
|
|
|
private Tobacco tobacco;
|
2015-05-22 23:37:42 +03:00
|
|
|
|
2015-11-01 18:48:43 -05:00
|
|
|
public AdvancedWizard(Tobacco tobacco) {
|
|
|
|
this.tobacco = tobacco;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void smoke() {
|
|
|
|
tobacco.smoke(this);
|
|
|
|
}
|
2015-05-22 23:37:42 +03:00
|
|
|
}
|