#107 JavaDoc improvements for the Builder example

This commit is contained in:
Ilkka Seppala 2015-08-18 21:37:07 +03:00
parent 1dc2d8d0c7
commit 81dda94abd
8 changed files with 157 additions and 123 deletions

View File

@ -6,17 +6,21 @@ import com.iluwatar. builder.Hero.HeroBuilder;
* *
* This is the Builder pattern variation as described by Joshua Bloch in * This is the Builder pattern variation as described by Joshua Bloch in
* Effective Java 2nd Edition. * Effective Java 2nd Edition.
* * <p>
* We want to build Hero objects, but its construction is complex because of the * We want to build {@link Hero} objects, but its construction is complex because of the
* many parameters needed. To aid the user we introduce HeroBuilder class. * many parameters needed. To aid the user we introduce {@link HeroBuilder} class.
* HeroBuilder takes the minimum parameters to build Hero object in its * {@link HeroBuilder} takes the minimum parameters to build {@link Hero} object in its
* constructor. After that additional configuration for the Hero object can be * constructor. After that additional configuration for the {@link Hero} object can be
* done using the fluent HeroBuilder interface. When configuration is ready the * done using the fluent {@link HeroBuilder} interface. When configuration is ready the
* build method is called to receive the final Hero object. * build method is called to receive the final {@link Hero} object.
* *
*/ */
public class App { public class App {
/**
* Program entry point
* @param args command line args
*/
public static void main(String[] args) { public static void main(String[] args) {
Hero mage = new HeroBuilder(Profession.MAGE, "Riobard") Hero mage = new HeroBuilder(Profession.MAGE, "Riobard")

View File

@ -1,5 +1,10 @@
package com.iluwatar.builder; package com.iluwatar.builder;
/**
*
* Armor enumeration
*
*/
public enum Armor { 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");

View File

@ -1,5 +1,10 @@
package com.iluwatar.builder; package com.iluwatar.builder;
/**
*
* HairColor enumeration
*
*/
public enum HairColor { public enum HairColor {
WHITE, BLOND, RED, BROWN, BLACK; WHITE, BLOND, RED, BROWN, BLACK;

View File

@ -1,5 +1,10 @@
package com.iluwatar.builder; package com.iluwatar.builder;
/**
*
* HairType enumeration
*
*/
public enum HairType { 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");

View File

@ -2,7 +2,7 @@ package com.iluwatar.builder;
/** /**
* *
* The class with many parameters. * Hero, the class with many parameters.
* *
*/ */
public class Hero { public class Hero {

View File

@ -1,5 +1,10 @@
package com.iluwatar.builder; package com.iluwatar.builder;
/**
*
* Profession enumeration
*
*/
public enum Profession { public enum Profession {
WARRIOR, THIEF, MAGE, PRIEST; WARRIOR, THIEF, MAGE, PRIEST;

View File

@ -1,5 +1,10 @@
package com.iluwatar.builder; package com.iluwatar.builder;
/**
*
* Weapon enumeration
*
*/
public enum Weapon { public enum Weapon {
DAGGER, SWORD, AXE, WARHAMMER, BOW; DAGGER, SWORD, AXE, WARHAMMER, BOW;

View File

@ -4,6 +4,11 @@ import org.junit.Test;
import com.iluwatar. builder.App; import com.iluwatar. builder.App;
/**
*
* Application test
*
*/
public class AppTest { public class AppTest {
@Test @Test