#107 JavaDoc improvements for the Builder example
This commit is contained in:
@ -6,17 +6,21 @@ import com.iluwatar. builder.Hero.HeroBuilder;
|
||||
*
|
||||
* This is the Builder pattern variation as described by Joshua Bloch in
|
||||
* Effective Java 2nd Edition.
|
||||
*
|
||||
* We want to build Hero objects, but its construction is complex because of the
|
||||
* many parameters needed. To aid the user we introduce HeroBuilder class.
|
||||
* HeroBuilder takes the minimum parameters to build Hero object in its
|
||||
* constructor. After that additional configuration for the Hero object can be
|
||||
* done using the fluent HeroBuilder interface. When configuration is ready the
|
||||
* build method is called to receive the final Hero object.
|
||||
* <p>
|
||||
* 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} 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 the final {@link Hero} object.
|
||||
*
|
||||
*/
|
||||
public class App {
|
||||
|
||||
/**
|
||||
* Program entry point
|
||||
* @param args command line args
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
|
||||
Hero mage = new HeroBuilder(Profession.MAGE, "Riobard")
|
||||
|
@ -1,5 +1,10 @@
|
||||
package com.iluwatar.builder;
|
||||
|
||||
/**
|
||||
*
|
||||
* Armor enumeration
|
||||
*
|
||||
*/
|
||||
public enum Armor {
|
||||
|
||||
CLOTHES("clothes"), LEATHER("leather"), CHAIN_MAIL("chain mail"), PLATE_MAIL("plate mail");
|
||||
|
@ -1,5 +1,10 @@
|
||||
package com.iluwatar.builder;
|
||||
|
||||
/**
|
||||
*
|
||||
* HairColor enumeration
|
||||
*
|
||||
*/
|
||||
public enum HairColor {
|
||||
|
||||
WHITE, BLOND, RED, BROWN, BLACK;
|
||||
|
@ -1,5 +1,10 @@
|
||||
package com.iluwatar.builder;
|
||||
|
||||
/**
|
||||
*
|
||||
* HairType enumeration
|
||||
*
|
||||
*/
|
||||
public enum HairType {
|
||||
|
||||
BALD("bald"), SHORT("short"), CURLY("curly"), LONG_STRAIGHT("long straight"), LONG_CURLY("long curly");
|
||||
|
@ -2,7 +2,7 @@ package com.iluwatar.builder;
|
||||
|
||||
/**
|
||||
*
|
||||
* The class with many parameters.
|
||||
* Hero, the class with many parameters.
|
||||
*
|
||||
*/
|
||||
public class Hero {
|
||||
|
@ -1,5 +1,10 @@
|
||||
package com.iluwatar.builder;
|
||||
|
||||
/**
|
||||
*
|
||||
* Profession enumeration
|
||||
*
|
||||
*/
|
||||
public enum Profession {
|
||||
|
||||
WARRIOR, THIEF, MAGE, PRIEST;
|
||||
|
@ -1,5 +1,10 @@
|
||||
package com.iluwatar.builder;
|
||||
|
||||
/**
|
||||
*
|
||||
* Weapon enumeration
|
||||
*
|
||||
*/
|
||||
public enum Weapon {
|
||||
|
||||
DAGGER, SWORD, AXE, WARHAMMER, BOW;
|
||||
|
@ -4,6 +4,11 @@ import org.junit.Test;
|
||||
|
||||
import com.iluwatar. builder.App;
|
||||
|
||||
/**
|
||||
*
|
||||
* Application test
|
||||
*
|
||||
*/
|
||||
public class AppTest {
|
||||
|
||||
@Test
|
||||
|
Reference in New Issue
Block a user