mirror of
https://github.com/tiennm99/java-design-patterns.git
synced 2026-05-16 14:59:21 +00:00
📍Use lombok, reformat, and optimize the code (#1560)
* Use lombok, reformat, and optimize the code * Fix merge conflicts and some sonar issues Co-authored-by: va1m <va1m@email.com>
This commit is contained in:
+3
-4
@@ -23,18 +23,17 @@
|
||||
|
||||
package com.iluwatar.dependency.injection;
|
||||
|
||||
import lombok.Setter;
|
||||
|
||||
/**
|
||||
* AdvancedSorceress implements inversion of control. It depends on abstraction that can be injected
|
||||
* through its setter.
|
||||
*/
|
||||
@Setter
|
||||
public class AdvancedSorceress implements Wizard {
|
||||
|
||||
private Tobacco tobacco;
|
||||
|
||||
public void setTobacco(Tobacco tobacco) {
|
||||
this.tobacco = tobacco;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void smoke() {
|
||||
tobacco.smoke(this);
|
||||
|
||||
+3
-4
@@ -23,18 +23,17 @@
|
||||
|
||||
package com.iluwatar.dependency.injection;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
/**
|
||||
* AdvancedWizard implements inversion of control. It depends on abstraction that can be injected
|
||||
* through its constructor.
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
public class AdvancedWizard implements Wizard {
|
||||
|
||||
private final Tobacco tobacco;
|
||||
|
||||
public AdvancedWizard(Tobacco tobacco) {
|
||||
this.tobacco = tobacco;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void smoke() {
|
||||
tobacco.smoke(this);
|
||||
|
||||
@@ -23,16 +23,14 @@
|
||||
|
||||
package com.iluwatar.dependency.injection;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* Tobacco abstraction.
|
||||
*/
|
||||
@Slf4j
|
||||
public abstract class Tobacco {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(Tobacco.class);
|
||||
|
||||
public void smoke(Wizard wizard) {
|
||||
LOGGER.info("{} smoking {}", wizard.getClass().getSimpleName(),
|
||||
this.getClass().getSimpleName());
|
||||
|
||||
Reference in New Issue
Block a user