File tree Expand file tree Collapse file tree 2 files changed +24
-3
lines changed
feature-toggle/src/main/java/com/iluwatar/featuretoggle/user Expand file tree Collapse file tree 2 files changed +24
-3
lines changed Original file line number Diff line number Diff line change 1
1
package com .iluwatar .featuretoggle .user ;
2
2
3
+ /**
4
+ * Used to demonstrate the purpose of the feature toggle. This class actually has nothing to do with the pattern.
5
+ */
3
6
public class User {
4
7
5
8
private String name ;
6
9
10
+ /**
11
+ * Default Constructor setting the username.
12
+ *
13
+ * @param name {@link String} to represent the name of the user.
14
+ */
7
15
public User (String name ) {
8
16
this .name = name ;
9
17
}
10
18
19
+ /**
20
+ * {@inheritDoc}
21
+ * @return The {@link String} representation of the User, in this case just return the name of the user.
22
+ */
11
23
@ Override
12
24
public String toString () {
13
25
return name ;
Original file line number Diff line number Diff line change 4
4
import java .util .List ;
5
5
6
6
/**
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
8
11
*/
9
12
public class UserGroup {
10
13
@@ -13,10 +16,13 @@ public class UserGroup {
13
16
14
17
15
18
/**
19
+ * Add the passed {@link User} to the free user group list.
16
20
*
17
21
* @param user {@link User} to be added to the free group
22
+ * @throws IllegalArgumentException
23
+ * @see User
18
24
*/
19
- public static void addUserToFreeGroup (final User user ) {
25
+ public static void addUserToFreeGroup (final User user ) throws IllegalArgumentException {
20
26
if (paidGroup .contains (user )) {
21
27
throw new IllegalArgumentException ("User all ready member of paid group." );
22
28
} else {
@@ -27,10 +33,13 @@ public static void addUserToFreeGroup(final User user) {
27
33
}
28
34
29
35
/**
36
+ * Add the passed {@link User} to the paid user group list.
30
37
*
31
38
* @param user {@link User} to be added to the paid group
39
+ * @throws IllegalArgumentException
40
+ * @see User
32
41
*/
33
- public static void addUserToPaidGroup (final User user ) {
42
+ public static void addUserToPaidGroup (final User user ) throws IllegalArgumentException {
34
43
if (freeGroup .contains (user )) {
35
44
throw new IllegalArgumentException ("User all ready member of free group." );
36
45
} else {
You can’t perform that action at this time.
0 commit comments