From 98326a1e5e27d112f91949bcdfede5ecfda40704 Mon Sep 17 00:00:00 2001 From: Joseph McCarthy Date: Thu, 28 Jan 2016 21:14:40 +0000 Subject: [PATCH] #354 Start Adding Java docs --- .../com/iluwatar/featuretoggle/user/User.java | 12 ++++++++++++ .../iluwatar/featuretoggle/user/UserGroup.java | 15 ++++++++++++--- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/feature-toggle/src/main/java/com/iluwatar/featuretoggle/user/User.java b/feature-toggle/src/main/java/com/iluwatar/featuretoggle/user/User.java index 12b4cc06e..70b241389 100644 --- a/feature-toggle/src/main/java/com/iluwatar/featuretoggle/user/User.java +++ b/feature-toggle/src/main/java/com/iluwatar/featuretoggle/user/User.java @@ -1,13 +1,25 @@ package com.iluwatar.featuretoggle.user; +/** + * Used to demonstrate the purpose of the feature toggle. This class actually has nothing to do with the pattern. + */ public class User { private String name; + /** + * Default Constructor setting the username. + * + * @param name {@link String} to represent the name of the user. + */ public User(String name) { this.name = name; } + /** + * {@inheritDoc} + * @return The {@link String} representation of the User, in this case just return the name of the user. + */ @Override public String toString() { return name; diff --git a/feature-toggle/src/main/java/com/iluwatar/featuretoggle/user/UserGroup.java b/feature-toggle/src/main/java/com/iluwatar/featuretoggle/user/UserGroup.java index d3052ac21..fec972eb1 100644 --- a/feature-toggle/src/main/java/com/iluwatar/featuretoggle/user/UserGroup.java +++ b/feature-toggle/src/main/java/com/iluwatar/featuretoggle/user/UserGroup.java @@ -4,7 +4,10 @@ import java.util.ArrayList; import java.util.List; /** - * Contains the lists of users of different groups paid and free + * Contains the lists of users of different groups paid and free. Used to demonstrate the tiered example of feature + * toggle. Allowing certain features to be available to only certain groups of users. + * + * @see User */ public class UserGroup { @@ -13,10 +16,13 @@ public class UserGroup { /** + * Add the passed {@link User} to the free user group list. * * @param user {@link User} to be added to the free group + * @throws IllegalArgumentException + * @see User */ - public static void addUserToFreeGroup(final User user) { + public static void addUserToFreeGroup(final User user) throws IllegalArgumentException { if (paidGroup.contains(user)) { throw new IllegalArgumentException("User all ready member of paid group."); } else { @@ -27,10 +33,13 @@ public class UserGroup { } /** + * Add the passed {@link User} to the paid user group list. * * @param user {@link User} to be added to the paid group + * @throws IllegalArgumentException + * @see User */ - public static void addUserToPaidGroup(final User user) { + public static void addUserToPaidGroup(final User user) throws IllegalArgumentException { if (freeGroup.contains(user)) { throw new IllegalArgumentException("User all ready member of free group."); } else {