📍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:
va1m
2021-03-13 13:19:21 +01:00
committed by GitHub
parent 0e26a6adb5
commit 5cf2fe009b
681 changed files with 2472 additions and 4966 deletions

View File

@ -24,8 +24,7 @@
package com.iluwatar.builder;
import com.iluwatar.builder.Hero.Builder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import lombok.extern.slf4j.Slf4j;
/**
* The intention of the Builder pattern is to find a solution to the telescoping constructor
@ -48,10 +47,9 @@ import org.slf4j.LoggerFactory;
* configuration for the {@link Hero} object can be done using the fluent {@link Builder} interface.
* When configuration is ready the build method is called to receive the final {@link Hero} object.
*/
@Slf4j
public class App {
private static final Logger LOGGER = LoggerFactory.getLogger(App.class);
/**
* Program entry point.
*
@ -76,6 +74,5 @@ public class App {
.withWeapon(Weapon.BOW)
.build();
LOGGER.info(thief.toString());
}
}

View File

@ -23,19 +23,21 @@
package com.iluwatar.builder;
import lombok.AllArgsConstructor;
/**
* Armor enumeration.
*/
@AllArgsConstructor
public enum Armor {
CLOTHES("clothes"), LEATHER("leather"), CHAIN_MAIL("chain mail"), PLATE_MAIL("plate mail");
CLOTHES("clothes"),
LEATHER("leather"),
CHAIN_MAIL("chain mail"),
PLATE_MAIL("plate mail");
private final String title;
Armor(String title) {
this.title = title;
}
@Override
public String toString() {
return title;

View File

@ -28,7 +28,11 @@ package com.iluwatar.builder;
*/
public enum HairColor {
WHITE, BLOND, RED, BROWN, BLACK;
WHITE,
BLOND,
RED,
BROWN,
BLACK;
@Override
public String toString() {

View File

@ -23,20 +23,22 @@
package com.iluwatar.builder;
import lombok.AllArgsConstructor;
/**
* HairType enumeration.
*/
@AllArgsConstructor
public enum HairType {
BALD("bald"), SHORT("short"), CURLY("curly"), LONG_STRAIGHT("long straight"), LONG_CURLY(
"long curly");
BALD("bald"),
SHORT("short"),
CURLY("curly"),
LONG_STRAIGHT("long straight"),
LONG_CURLY("long curly");
private final String title;
HairType(String title) {
this.title = title;
}
@Override
public String toString() {
return title;

View File

@ -41,7 +41,6 @@ class AppTest {
@Test
void shouldExecuteApplicationWithoutException() {
assertDoesNotThrow(() -> App.main(new String[]{}));
}
}