File tree Expand file tree Collapse file tree
feature-toggle/src/main/java/com/iluwatar/featuretoggle/user Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11package 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+ */
36public 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 ;
Original file line number Diff line number Diff line change 44import 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 */
912public 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 {
You can’t perform that action at this time.
0 commit comments