#354 Start Adding Java docs

This commit is contained in:
Joseph McCarthy 2016-01-28 21:14:40 +00:00
parent 77e14f0069
commit 98326a1e5e
2 changed files with 24 additions and 3 deletions

View File

@ -1,13 +1,25 @@
package com.iluwatar.featuretoggle.user; 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 { public class User {
private String name; private String name;
/**
* Default Constructor setting the username.
*
* @param name {@link String} to represent the name of the user.
*/
public User(String name) { public User(String name) {
this.name = name; this.name = name;
} }
/**
* {@inheritDoc}
* @return The {@link String} representation of the User, in this case just return the name of the user.
*/
@Override @Override
public String toString() { public String toString() {
return name; return name;

View File

@ -4,7 +4,10 @@ import java.util.ArrayList;
import java.util.List; 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 { 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 * @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)) { if (paidGroup.contains(user)) {
throw new IllegalArgumentException("User all ready member of paid group."); throw new IllegalArgumentException("User all ready member of paid group.");
} else { } 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 * @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)) { if (freeGroup.contains(user)) {
throw new IllegalArgumentException("User all ready member of free group."); throw new IllegalArgumentException("User all ready member of free group.");
} else { } else {