Skip to content

Commit 6ab9b36

Browse files
committed
issue iluwatar#333 javadocs changes
1 parent 2fa705a commit 6ab9b36

File tree

4 files changed

+24
-5
lines changed

4 files changed

+24
-5
lines changed

factory-kit/src/main/java/com/iluwatar/factorykit/App.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
package com.iluwatar.factorykit;
22

33
public class App {
4-
4+
/**
5+
* Program entry point.
6+
*
7+
* @param args @param args command line args
8+
*/
59
public static void main(String[] args) {
610
WeaponFactory factory = WeaponFactory.factory(builder -> {
711
builder.add(WeaponType.SWORD, Sword::new);
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package com.iluwatar.factorykit;
22

33
/**
4-
* Interface representing weapon
4+
* Interface representing weapon.
55
*/
66
public interface Weapon {
77
}

factory-kit/src/main/java/com/iluwatar/factorykit/WeaponFactory.java

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,26 @@
55
import java.util.function.Supplier;
66

77
/**
8-
* Functional interface that represents factory kit. Instance created locally gives an opportunity to strictly define
9-
* which objects types the instance of a factory would be able to create. Factory is just a placeholder for builders with
10-
* create method to initialize new objects.
8+
* Functional interface, an example of the factory-kit design pattern.
9+
* <br>Instance created locally gives an opportunity to strictly define
10+
* which objects types the instance of a factory will be able to create.
11+
* <br>Factory is a placeholder for {@link Builder}s
12+
* with {@link WeaponFactory#create(WeaponType)} method to initialize new objects.
1113
*/
1214
public interface WeaponFactory {
1315

16+
/**
17+
* Creates an instance of the given type.
18+
* @param name representing enum of an object type to be created.
19+
* @return new instance of a requested class implementing {@link Weapon} interface.
20+
*/
1421
Weapon create(WeaponType name);
1522

23+
/**
24+
* Creates factory - placeholder for specified {@link Builder}s.
25+
* @param consumer for the new builder to the factory.
26+
* @return factory with specified {@link Builder}s
27+
*/
1628
static WeaponFactory factory(Consumer<Builder> consumer) {
1729
HashMap<WeaponType, Supplier<Weapon>> map = new HashMap<>();
1830
consumer.accept(map::put);
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
package com.iluwatar.factorykit;
22

3+
/**
4+
* Enumerates {@link Weapon} types
5+
*/
36
public enum WeaponType {
47
SWORD, AXE, BOW, SPEAR
58
}

0 commit comments

Comments
 (0)