#107 Factory Method example JavaDoc

This commit is contained in:
Ilkka Seppala
2015-08-18 22:44:58 +03:00
parent 87717a581b
commit 1ec86b732a
6 changed files with 33 additions and 3 deletions

View File

@ -2,13 +2,18 @@ package com.iluwatar.factory.method;
/**
*
* In Factory Method we have an interface (Blacksmith) with a method for
* creating objects (manufactureWeapon). The concrete subclasses (OrcBlacksmith,
* ElfBlacksmith) then override the method to produce objects of their liking.
* In Factory Method we have an interface ({@link Blacksmith}) with a method for
* creating objects ({@link Blacksmith#manufactureWeapon}). The concrete subclasses
* ({@link OrcBlacksmith}, {@link ElfBlacksmith}) then override the method to produce
* objects of their liking.
*
*/
public class App {
/**
* Program entry point
* @param args command line args
*/
public static void main(String[] args) {
Blacksmith blacksmith;
Weapon weapon;

View File

@ -1,5 +1,10 @@
package com.iluwatar.factory.method;
/**
*
* ElfWeapon
*
*/
public class ElfWeapon implements Weapon {
private WeaponType weaponType;

View File

@ -1,5 +1,10 @@
package com.iluwatar.factory.method;
/**
*
* OrcWeapon
*
*/
public class OrcWeapon implements Weapon {
private WeaponType weaponType;

View File

@ -1,5 +1,10 @@
package com.iluwatar.factory.method;
/**
*
* Weapon interface
*
*/
public interface Weapon {
}

View File

@ -1,5 +1,10 @@
package com.iluwatar.factory.method;
/**
*
* WeaponType enumeration
*
*/
public enum WeaponType {
SHORT_SWORD("short sword"), SPEAR("spear"), AXE("axe"), UNDEFINED("");

View File

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