X Tutup
Skip to content

Commit 1ec86b7

Browse files
committed
iluwatar#107 Factory Method example JavaDoc
1 parent 87717a5 commit 1ec86b7

File tree

6 files changed

+33
-3
lines changed

6 files changed

+33
-3
lines changed

factory-method/src/main/java/com/iluwatar/factory/method/App.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,18 @@
22

33
/**
44
*
5-
* In Factory Method we have an interface (Blacksmith) with a method for
6-
* creating objects (manufactureWeapon). The concrete subclasses (OrcBlacksmith,
7-
* ElfBlacksmith) then override the method to produce objects of their liking.
5+
* In Factory Method we have an interface ({@link Blacksmith}) with a method for
6+
* creating objects ({@link Blacksmith#manufactureWeapon}). The concrete subclasses
7+
* ({@link OrcBlacksmith}, {@link ElfBlacksmith}) then override the method to produce
8+
* objects of their liking.
89
*
910
*/
1011
public class App {
1112

13+
/**
14+
* Program entry point
15+
* @param args command line args
16+
*/
1217
public static void main(String[] args) {
1318
Blacksmith blacksmith;
1419
Weapon weapon;

factory-method/src/main/java/com/iluwatar/factory/method/ElfWeapon.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
package com.iluwatar.factory.method;
22

3+
/**
4+
*
5+
* ElfWeapon
6+
*
7+
*/
38
public class ElfWeapon implements Weapon {
49

510
private WeaponType weaponType;

factory-method/src/main/java/com/iluwatar/factory/method/OrcWeapon.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
package com.iluwatar.factory.method;
22

3+
/**
4+
*
5+
* OrcWeapon
6+
*
7+
*/
38
public class OrcWeapon implements Weapon {
49

510
private WeaponType weaponType;
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
package com.iluwatar.factory.method;
22

3+
/**
4+
*
5+
* Weapon interface
6+
*
7+
*/
38
public interface Weapon {
49

510
}

factory-method/src/main/java/com/iluwatar/factory/method/WeaponType.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
package com.iluwatar.factory.method;
22

3+
/**
4+
*
5+
* WeaponType enumeration
6+
*
7+
*/
38
public enum WeaponType {
49

510
SHORT_SWORD("short sword"), SPEAR("spear"), AXE("axe"), UNDEFINED("");

factory-method/src/test/java/com/iluwatar/factory/method/AppTest.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@
44

55
import com.iluwatar.factory.method.App;
66

7+
/**
8+
*
9+
* Application test
10+
*
11+
*/
712
public class AppTest {
813

914
@Test

0 commit comments

Comments
 (0)
X Tutup