File tree Expand file tree Collapse file tree 3 files changed +16
-3
lines changed
src/main/java/com/iluwatar/factorykit
factory-method/src/test/java/com/iluwatar/factory/method Expand file tree Collapse file tree 3 files changed +16
-3
lines changed Original file line number Diff line number Diff line change 11
11
---
12
12
13
13
## Intent
14
- Define factory of immutable content with separated builder and factory interfaces.
14
+ Define a factory of immutable content with separated builder and factory interfaces.
15
15
16
16
![ alt text] ( ./etc/factory-kit.png " Factory Kit ")
17
17
Original file line number Diff line number Diff line change 1
1
package com .iluwatar .factorykit ;
2
2
3
+ /**
4
+ * Factory-kit is a creational pattern which defines a factory of immutable content
5
+ * with separated builder and factory interfaces to deal with the problem of
6
+ * creating one of the objects specified directly in the factory-kit instance.
7
+ *
8
+ * <p>
9
+ * In the given example {@link WeaponFactory} represents the factory-kit, that contains
10
+ * four {@link Builder}s for creating new objects of
11
+ * the classes implementing {@link Weapon} interface.
12
+ * <br>Each of them can be called with {@link WeaponFactory#create(WeaponType)} method, with
13
+ * an input representing an instance of {@link WeaponType} that needs to
14
+ * be mapped explicitly with desired class type in the factory instance.
15
+ */
3
16
public class App {
4
17
/**
5
18
* Program entry point.
Original file line number Diff line number Diff line change @@ -93,9 +93,9 @@ public void testElfBlacksmithWithSpear() {
93
93
* @param expectedWeaponType expected WeaponType of the weapon
94
94
* @param clazz expected class of the weapon
95
95
*/
96
- private void verifyWeapon (Weapon weapon , WeaponType expectedWeaponType , Class clazz ) {
96
+ private void verifyWeapon (Weapon weapon , WeaponType expectedWeaponType , Class <?> clazz ) {
97
97
assertTrue ("Weapon must be an object of: " + clazz .getName (), clazz .isInstance (weapon ));
98
98
assertEquals ("Weapon must be of weaponType: " + clazz .getName (), expectedWeaponType ,
99
99
weapon .getWeaponType ());
100
100
}
101
- }
101
+ }
You can’t perform that action at this time.
0 commit comments