publicBuilder(Profession profession, String name) { if (profession == null || name == null) { thrownewIllegalArgumentException("profession and name can not be null"); } this.profession = profession; this.name = name; }
public Builder withHairType(HairType hairType) { this.hairType = hairType; returnthis; }
public Builder withHairColor(HairColor hairColor) { this.hairColor = hairColor; returnthis; }
public Builder withArmor(Armor armor) { this.armor = armor; returnthis; }
public Builder withWeapon(Weapon weapon) { this.weapon = weapon; returnthis; }
16:28:06.058 [main] INFO com.iluwatar.builder.App -- This is a mage named Riobard with black hair and wielding a dagger. 16:28:06.060 [main] INFO com.iluwatar.builder.App -- This is a warrior named Amberjill with blond long curly hair wearing chain mail and wielding a sword. 16:28:06.060 [main] INFO com.iluwatar.builder.App -- This is a thief named Desmond with bald head and wielding a bow.