📍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:
		| @@ -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()); | ||||
|  | ||||
|   } | ||||
| } | ||||
|   | ||||
| @@ -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; | ||||
|   | ||||
| @@ -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() { | ||||
|   | ||||
| @@ -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; | ||||
|   | ||||
| @@ -41,7 +41,6 @@ class AppTest { | ||||
|  | ||||
|   @Test | ||||
|   void shouldExecuteApplicationWithoutException() { | ||||
|  | ||||
|     assertDoesNotThrow(() -> App.main(new String[]{})); | ||||
|   } | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user