diff --git a/builder/etc/builder.ucls b/builder/etc/builder.ucls
index 06a83ced7..073c5cea7 100644
--- a/builder/etc/builder.ucls
+++ b/builder/etc/builder.ucls
@@ -28,7 +28,7 @@
-
* We want to build {@link Hero} objects, but its construction is complex because of the many
- * parameters needed. To aid the user we introduce {@link HeroBuilder} class. {@link HeroBuilder}
+ * parameters needed. To aid the user we introduce {@link Builder} class. {@link Hero.Builder}
* takes the minimum parameters to build {@link Hero} object in its constructor. After that
* additional configuration for the {@link Hero} object can be done using the fluent
- * {@link HeroBuilder} interface. When configuration is ready the build method is called to receive
+ * {@link Builder} interface. When configuration is ready the build method is called to receive
* the final {@link Hero} object.
*
*/
@@ -58,18 +58,18 @@ public class App {
public static void main(String[] args) {
Hero mage =
- new HeroBuilder(Profession.MAGE, "Riobard").withHairColor(HairColor.BLACK)
+ new Hero.Builder(Profession.MAGE, "Riobard").withHairColor(HairColor.BLACK)
.withWeapon(Weapon.DAGGER).build();
System.out.println(mage);
Hero warrior =
- new HeroBuilder(Profession.WARRIOR, "Amberjill").withHairColor(HairColor.BLOND)
+ new Hero.Builder(Profession.WARRIOR, "Amberjill").withHairColor(HairColor.BLOND)
.withHairType(HairType.LONG_CURLY).withArmor(Armor.CHAIN_MAIL).withWeapon(Weapon.SWORD)
.build();
System.out.println(warrior);
Hero thief =
- new HeroBuilder(Profession.THIEF, "Desmond").withHairType(HairType.BALD)
+ new Hero.Builder(Profession.THIEF, "Desmond").withHairType(HairType.BALD)
.withWeapon(Weapon.BOW).build();
System.out.println(thief);
diff --git a/builder/src/main/java/com/iluwatar/builder/Hero.java b/builder/src/main/java/com/iluwatar/builder/Hero.java
index 1835df638..25445851a 100644
--- a/builder/src/main/java/com/iluwatar/builder/Hero.java
+++ b/builder/src/main/java/com/iluwatar/builder/Hero.java
@@ -36,7 +36,7 @@ public final class Hero {
private final Armor armor;
private final Weapon weapon;
- private Hero(HeroBuilder builder) {
+ private Hero(Builder builder) {
this.profession = builder.profession;
this.name = builder.name;
this.hairColor = builder.hairColor;
@@ -102,7 +102,7 @@ public final class Hero {
* The builder class.
*
*/
- public static class HeroBuilder {
+ public static class Builder {
private final Profession profession;
private final String name;
@@ -114,7 +114,7 @@ public final class Hero {
/**
* Constructor
*/
- public HeroBuilder(Profession profession, String name) {
+ public Builder(Profession profession, String name) {
if (profession == null || name == null) {
throw new IllegalArgumentException("profession and name can not be null");
}
@@ -122,22 +122,22 @@ public final class Hero {
this.name = name;
}
- public HeroBuilder withHairType(HairType hairType) {
+ public Builder withHairType(HairType hairType) {
this.hairType = hairType;
return this;
}
- public HeroBuilder withHairColor(HairColor hairColor) {
+ public Builder withHairColor(HairColor hairColor) {
this.hairColor = hairColor;
return this;
}
- public HeroBuilder withArmor(Armor armor) {
+ public Builder withArmor(Armor armor) {
this.armor = armor;
return this;
}
- public HeroBuilder withWeapon(Weapon weapon) {
+ public Builder withWeapon(Weapon weapon) {
this.weapon = weapon;
return this;
}
diff --git a/builder/src/test/java/com/iluwatar/builder/HeroTest.java b/builder/src/test/java/com/iluwatar/builder/HeroTest.java
index 3c308e8c1..b0a73a9d0 100644
--- a/builder/src/test/java/com/iluwatar/builder/HeroTest.java
+++ b/builder/src/test/java/com/iluwatar/builder/HeroTest.java
@@ -39,7 +39,7 @@ public class HeroTest {
*/
@Test(expected = IllegalArgumentException.class)
public void testMissingProfession() throws Exception {
- new Hero.HeroBuilder(null, "Sir without a job");
+ new Hero.Builder(null, "Sir without a job");
}
/**
@@ -47,7 +47,7 @@ public class HeroTest {
*/
@Test(expected = IllegalArgumentException.class)
public void testMissingName() throws Exception {
- new Hero.HeroBuilder(Profession.THIEF, null);
+ new Hero.Builder(Profession.THIEF, null);
}
/**
@@ -57,7 +57,7 @@ public class HeroTest {
public void testBuildHero() throws Exception {
final String heroName = "Sir Lancelot";
- final Hero hero = new Hero.HeroBuilder(Profession.WARRIOR, heroName)
+ final Hero hero = new Hero.Builder(Profession.WARRIOR, heroName)
.withArmor(Armor.CHAIN_MAIL)
.withWeapon(Weapon.SWORD)
.withHairType(HairType.LONG_CURLY)