Skip to content

Commit 98326a1

Browse files
committed
iluwatar#354 Start Adding Java docs
1 parent 77e14f0 commit 98326a1

File tree

2 files changed

+24
-3
lines changed

2 files changed

+24
-3
lines changed

feature-toggle/src/main/java/com/iluwatar/featuretoggle/user/User.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,25 @@
11
package com.iluwatar.featuretoggle.user;
22

3+
/**
4+
* Used to demonstrate the purpose of the feature toggle. This class actually has nothing to do with the pattern.
5+
*/
36
public class User {
47

58
private String name;
69

10+
/**
11+
* Default Constructor setting the username.
12+
*
13+
* @param name {@link String} to represent the name of the user.
14+
*/
715
public User(String name) {
816
this.name = name;
917
}
1018

19+
/**
20+
* {@inheritDoc}
21+
* @return The {@link String} representation of the User, in this case just return the name of the user.
22+
*/
1123
@Override
1224
public String toString() {
1325
return name;

feature-toggle/src/main/java/com/iluwatar/featuretoggle/user/UserGroup.java

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@
44
import java.util.List;
55

66
/**
7-
* Contains the lists of users of different groups paid and free
7+
* Contains the lists of users of different groups paid and free. Used to demonstrate the tiered example of feature
8+
* toggle. Allowing certain features to be available to only certain groups of users.
9+
*
10+
* @see User
811
*/
912
public class UserGroup {
1013

@@ -13,10 +16,13 @@ public class UserGroup {
1316

1417

1518
/**
19+
* Add the passed {@link User} to the free user group list.
1620
*
1721
* @param user {@link User} to be added to the free group
22+
* @throws IllegalArgumentException
23+
* @see User
1824
*/
19-
public static void addUserToFreeGroup(final User user) {
25+
public static void addUserToFreeGroup(final User user) throws IllegalArgumentException {
2026
if (paidGroup.contains(user)) {
2127
throw new IllegalArgumentException("User all ready member of paid group.");
2228
} else {
@@ -27,10 +33,13 @@ public static void addUserToFreeGroup(final User user) {
2733
}
2834

2935
/**
36+
* Add the passed {@link User} to the paid user group list.
3037
*
3138
* @param user {@link User} to be added to the paid group
39+
* @throws IllegalArgumentException
40+
* @see User
3241
*/
33-
public static void addUserToPaidGroup(final User user) {
42+
public static void addUserToPaidGroup(final User user) throws IllegalArgumentException {
3443
if (freeGroup.contains(user)) {
3544
throw new IllegalArgumentException("User all ready member of free group.");
3645
} else {

0 commit comments

Comments
 (0)