📍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:
@ -23,19 +23,19 @@
|
||||
|
||||
package com.iluwatar.command;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
/**
|
||||
* Enumeration for target size.
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
public enum Size {
|
||||
|
||||
SMALL("small"), NORMAL("normal");
|
||||
SMALL("small"),
|
||||
NORMAL("normal");
|
||||
|
||||
private final String title;
|
||||
|
||||
Size(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return title;
|
||||
|
@ -23,39 +23,22 @@
|
||||
|
||||
package com.iluwatar.command;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* Base class for spell targets.
|
||||
*/
|
||||
@Setter
|
||||
@Slf4j
|
||||
@Getter
|
||||
public abstract class Target {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(Target.class);
|
||||
|
||||
private Size size;
|
||||
|
||||
private Visibility visibility;
|
||||
|
||||
public Size getSize() {
|
||||
return size;
|
||||
}
|
||||
|
||||
public void setSize(Size size) {
|
||||
this.size = size;
|
||||
}
|
||||
|
||||
public Visibility getVisibility() {
|
||||
return visibility;
|
||||
}
|
||||
|
||||
public void setVisibility(Visibility visibility) {
|
||||
this.visibility = visibility;
|
||||
}
|
||||
|
||||
@Override
|
||||
public abstract String toString();
|
||||
|
||||
/**
|
||||
* Print status.
|
||||
*/
|
||||
|
@ -23,19 +23,19 @@
|
||||
|
||||
package com.iluwatar.command;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
/**
|
||||
* Enumeration for target visibility.
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
public enum Visibility {
|
||||
|
||||
VISIBLE("visible"), INVISIBLE("invisible");
|
||||
VISIBLE("visible"),
|
||||
INVISIBLE("invisible");
|
||||
|
||||
private final String title;
|
||||
|
||||
Visibility(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return title;
|
||||
|
@ -25,10 +25,12 @@ package com.iluwatar.command;
|
||||
|
||||
import java.util.Deque;
|
||||
import java.util.LinkedList;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* Wizard is the invoker of the commands.
|
||||
*/
|
||||
@Slf4j
|
||||
public class Wizard {
|
||||
|
||||
private final Deque<Runnable> undoStack = new LinkedList<>();
|
||||
|
@ -41,7 +41,7 @@ import org.junit.jupiter.api.Test;
|
||||
* objects are held by a client object (app). The client decides which commands to execute at which
|
||||
* points. To execute a command, it passes the command object to the invoker object.
|
||||
*/
|
||||
public class CommandTest {
|
||||
class CommandTest {
|
||||
|
||||
private static final String GOBLIN = "Goblin";
|
||||
|
||||
@ -51,7 +51,7 @@ public class CommandTest {
|
||||
* wizard keeps track of the spells undone, so they can be redone.
|
||||
*/
|
||||
@Test
|
||||
public void testCommand() {
|
||||
void testCommand() {
|
||||
|
||||
var wizard = new Wizard();
|
||||
var goblin = new Goblin();
|
||||
|
Reference in New Issue
Block a user