diff --git a/feature-toggle/src/main/java/com/iluwatar/featuretoggle/App.java b/feature-toggle/src/main/java/com/iluwatar/featuretoggle/App.java index 07d13423a..af8e731c8 100644 --- a/feature-toggle/src/main/java/com/iluwatar/featuretoggle/App.java +++ b/feature-toggle/src/main/java/com/iluwatar/featuretoggle/App.java @@ -28,46 +28,47 @@ import com.iluwatar.featuretoggle.pattern.propertiesversion.PropertiesFeatureTog import com.iluwatar.featuretoggle.pattern.tieredversion.TieredFeatureToggleVersion; import com.iluwatar.featuretoggle.user.User; import com.iluwatar.featuretoggle.user.UserGroup; +import java.util.Properties; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.Properties; - /** - * The Feature Toggle pattern allows for complete code executions to be turned on or off with ease. This allows features - * to be controlled by either dynamic methods just as {@link User} information or by {@link Properties}. In the App - * below there are two examples. Firstly the {@link Properties} version of the feature toggle, where the enhanced - * version of the welcome message which is personalised is turned either on or off at instance creation. This method - * is not as dynamic as the {@link User} driven version where the feature of the personalised welcome message is + * The Feature Toggle pattern allows for complete code executions to be turned on or off with ease. + * This allows features to be controlled by either dynamic methods just as {@link User} information + * or by {@link Properties}. In the App below there are two examples. Firstly the {@link Properties} + * version of the feature toggle, where the enhanced version of the welcome message which is + * personalised is turned either on or off at instance creation. This method is not as dynamic as + * the {@link User} driven version where the feature of the personalised welcome message is * dependant on the {@link UserGroup} the {@link User} is in. So if the user is a memeber of the * {@link UserGroup#isPaid(User)} then they get an ehanced version of the welcome message. * - * Note that this pattern can easily introduce code complexity, and if not kept in check can result in redundant - * unmaintained code within the codebase. - * + *

Note that this pattern can easily introduce code complexity, and if not kept in check can + * result in redundant unmaintained code within the codebase. */ public class App { private static final Logger LOGGER = LoggerFactory.getLogger(App.class); /** - * Block 1 shows the {@link PropertiesFeatureToggleVersion} being run with {@link Properties} setting the feature - * toggle to enabled. + * Block 1 shows the {@link PropertiesFeatureToggleVersion} being run with {@link Properties} + * setting the feature toggle to enabled. * - * Block 2 shows the {@link PropertiesFeatureToggleVersion} being run with {@link Properties} setting the feature - * toggle to disabled. Notice the difference with the printed welcome message the username is not included. + *

Block 2 shows the {@link PropertiesFeatureToggleVersion} being run with {@link Properties} + * setting the feature toggle to disabled. Notice the difference with the printed welcome message + * the username is not included. * - * Block 3 shows the {@link com.iluwatar.featuretoggle.pattern.tieredversion.TieredFeatureToggleVersion} being - * set up with two users on who is on the free level, while the other is on the paid level. When the - * {@link Service#getWelcomeMessage(User)} is called with the paid {@link User} note that the welcome message - * contains their username, while the same service call with the free tier user is more generic. No username is - * printed. + *

Block 3 shows the {@link + * com.iluwatar.featuretoggle.pattern.tieredversion.TieredFeatureToggleVersion} being set up with + * two users on who is on the free level, while the other is on the paid level. When the {@link + * Service#getWelcomeMessage(User)} is called with the paid {@link User} note that the welcome + * message contains their username, while the same service call with the free tier user is more + * generic. No username is printed. * - * @see User - * @see UserGroup - * @see Service - * @see PropertiesFeatureToggleVersion - * @see com.iluwatar.featuretoggle.pattern.tieredversion.TieredFeatureToggleVersion + * @see User + * @see UserGroup + * @see Service + * @see PropertiesFeatureToggleVersion + * @see com.iluwatar.featuretoggle.pattern.tieredversion.TieredFeatureToggleVersion */ public static void main(String[] args) { @@ -82,11 +83,12 @@ public class App { final Properties turnedOff = new Properties(); turnedOff.put("enhancedWelcome", false); Service turnedOffService = new PropertiesFeatureToggleVersion(turnedOff); - final String welcomeMessageturnedOff = turnedOffService.getWelcomeMessage(new User("Jamie No Code")); + final String welcomeMessageturnedOff = + turnedOffService.getWelcomeMessage(new User("Jamie No Code")); LOGGER.info(welcomeMessageturnedOff); // -------------------------------------------- - + Service service2 = new TieredFeatureToggleVersion(); final User paidUser = new User("Jamie Coder"); diff --git a/feature-toggle/src/main/java/com/iluwatar/featuretoggle/pattern/Service.java b/feature-toggle/src/main/java/com/iluwatar/featuretoggle/pattern/Service.java index ee2360b98..bd276f592 100644 --- a/feature-toggle/src/main/java/com/iluwatar/featuretoggle/pattern/Service.java +++ b/feature-toggle/src/main/java/com/iluwatar/featuretoggle/pattern/Service.java @@ -26,10 +26,11 @@ package com.iluwatar.featuretoggle.pattern; import com.iluwatar.featuretoggle.user.User; /** - * Simple interfaces to allow the calling of the method to generate the welcome message for a given user. While there is - * a helper method to gather the the status of the feature toggle. In some cases there is no need for the - * {@link Service#isEnhanced()} in {@link com.iluwatar.featuretoggle.pattern.tieredversion.TieredFeatureToggleVersion} - * where the toggle is determined by the actual {@link User}. + * Simple interfaces to allow the calling of the method to generate the welcome message for a given + * user. While there is a helper method to gather the the status of the feature toggle. In some + * cases there is no need for the {@link Service#isEnhanced()} in {@link + * com.iluwatar.featuretoggle.pattern.tieredversion.TieredFeatureToggleVersion} where the toggle is + * determined by the actual {@link User}. * * @see com.iluwatar.featuretoggle.pattern.propertiesversion.PropertiesFeatureToggleVersion * @see com.iluwatar.featuretoggle.pattern.tieredversion.TieredFeatureToggleVersion diff --git a/feature-toggle/src/main/java/com/iluwatar/featuretoggle/pattern/propertiesversion/PropertiesFeatureToggleVersion.java b/feature-toggle/src/main/java/com/iluwatar/featuretoggle/pattern/propertiesversion/PropertiesFeatureToggleVersion.java index 0696cf487..6e2281b9a 100644 --- a/feature-toggle/src/main/java/com/iluwatar/featuretoggle/pattern/propertiesversion/PropertiesFeatureToggleVersion.java +++ b/feature-toggle/src/main/java/com/iluwatar/featuretoggle/pattern/propertiesversion/PropertiesFeatureToggleVersion.java @@ -25,16 +25,16 @@ package com.iluwatar.featuretoggle.pattern.propertiesversion; import com.iluwatar.featuretoggle.pattern.Service; import com.iluwatar.featuretoggle.user.User; - import java.util.Properties; /** - * This example of the Feature Toogle pattern is less dynamic version than - * {@link com.iluwatar.featuretoggle.pattern.tieredversion.TieredFeatureToggleVersion} where the feature is turned on - * or off at the time of creation of the service. This example uses simple Java {@link Properties} however it could as - * easily be done with an external configuration file loaded by Spring and so on. A good example of when to use this - * version of the feature toggle is when new features are being developed. So you could have a configuration property - * boolean named development or some sort of system environment variable. + * This example of the Feature Toogle pattern is less dynamic version than {@link + * com.iluwatar.featuretoggle.pattern.tieredversion.TieredFeatureToggleVersion} where the feature is + * turned on or off at the time of creation of the service. This example uses simple Java {@link + * Properties} however it could as easily be done with an external configuration file loaded by + * Spring and so on. A good example of when to use this version of the feature toggle is when new + * features are being developed. So you could have a configuration property boolean named + * development or some sort of system environment variable. * * @see Service * @see com.iluwatar.featuretoggle.pattern.tieredversion.TieredFeatureToggleVersion @@ -45,9 +45,10 @@ public class PropertiesFeatureToggleVersion implements Service { private boolean isEnhanced; /** - * Creates an instance of {@link PropertiesFeatureToggleVersion} using the passed {@link Properties} to determine, - * the status of the feature toggle {@link PropertiesFeatureToggleVersion#isEnhanced()}. There is also some defensive - * code to ensure the {@link Properties} passed are as expected. + * Creates an instance of {@link PropertiesFeatureToggleVersion} using the passed {@link + * Properties} to determine, the status of the feature toggle {@link + * PropertiesFeatureToggleVersion#isEnhanced()}. There is also some defensive code to ensure the + * {@link Properties} passed are as expected. * * @param properties {@link Properties} used to configure the service and toggle features. * @throws IllegalArgumentException when the passed {@link Properties} is not as expected @@ -66,14 +67,14 @@ public class PropertiesFeatureToggleVersion implements Service { } /** - * Generate a welcome message based on the user being passed and the status of the feature toggle. If the enhanced - * version is enabled, then the message will be personalised with the name of the passed {@link User}. However if - * disabled then a generic version fo the message is returned. + * Generate a welcome message based on the user being passed and the status of the feature toggle. + * If the enhanced version is enabled, then the message will be personalised with the name of the + * passed {@link User}. However if disabled then a generic version fo the message is returned. * - * @param user the {@link User} to be displayed in the message if the enhanced version is enabled see - * {@link PropertiesFeatureToggleVersion#isEnhanced()}. If the enhanced version is enabled, then the - * message will be personalised with the name of the passed {@link User}. However if disabled then a - * generic version fo the message is returned. + * @param user the {@link User} to be displayed in the message if the enhanced version is enabled + * see {@link PropertiesFeatureToggleVersion#isEnhanced()}. If the enhanced version is + * enabled, then the message will be personalised with the name of the passed {@link + * User}. However if disabled then a generic version fo the message is returned. * @return Resulting welcome message. * @see User */ @@ -88,9 +89,9 @@ public class PropertiesFeatureToggleVersion implements Service { } /** - * Method that checks if the welcome message to be returned is the enhanced venison or not. For this service it will - * see the value of the boolean that was set in the constructor - * {@link PropertiesFeatureToggleVersion#PropertiesFeatureToggleVersion(Properties)} + * Method that checks if the welcome message to be returned is the enhanced venison or not. For + * this service it will see the value of the boolean that was set in the constructor {@link + * PropertiesFeatureToggleVersion#PropertiesFeatureToggleVersion(Properties)} * * @return Boolean value {@code true} if enhanced. */ diff --git a/feature-toggle/src/main/java/com/iluwatar/featuretoggle/pattern/tieredversion/TieredFeatureToggleVersion.java b/feature-toggle/src/main/java/com/iluwatar/featuretoggle/pattern/tieredversion/TieredFeatureToggleVersion.java index 9f50d280a..448218070 100644 --- a/feature-toggle/src/main/java/com/iluwatar/featuretoggle/pattern/tieredversion/TieredFeatureToggleVersion.java +++ b/feature-toggle/src/main/java/com/iluwatar/featuretoggle/pattern/tieredversion/TieredFeatureToggleVersion.java @@ -28,11 +28,12 @@ import com.iluwatar.featuretoggle.user.User; import com.iluwatar.featuretoggle.user.UserGroup; /** - * This example of the Feature Toogle pattern shows how it could be implemented based on a {@link User}. Therefore - * showing its use within a tiered application where the paying users get access to different content or - * better versions of features. So in this instance a {@link User} is passed in and if they are found to be - * on the {@link UserGroup#isPaid(User)} they are welcomed with a personalised message. While the other is more - * generic. However this pattern is limited to simple examples such as the one below. + * This example of the Feature Toogle pattern shows how it could be implemented based on a {@link + * User}. Therefore showing its use within a tiered application where the paying users get access to + * different content or better versions of features. So in this instance a {@link User} is passed in + * and if they are found to be on the {@link UserGroup#isPaid(User)} they are welcomed with a + * personalised message. While the other is more generic. However this pattern is limited to simple + * examples such as the one below. * * @see Service * @see User @@ -42,12 +43,13 @@ import com.iluwatar.featuretoggle.user.UserGroup; public class TieredFeatureToggleVersion implements Service { /** - * Generates a welcome message from the passed {@link User}. The resulting message depends on the group of the - * {@link User}. So if the {@link User} is in the {@link UserGroup#paidGroup} then the enhanced version of the - * welcome message will be returned where the username is displayed. + * Generates a welcome message from the passed {@link User}. The resulting message depends on the + * group of the {@link User}. So if the {@link User} is in the {@link UserGroup#paidGroup} then + * the enhanced version of the welcome message will be returned where the username is displayed. * - * @param user the {@link User} to generate the welcome message for, different messages are displayed if the user is - * in the {@link UserGroup#isPaid(User)} or {@link UserGroup#freeGroup} + * @param user the {@link User} to generate the welcome message for, different messages are + * displayed if the user is in the {@link UserGroup#isPaid(User)} or {@link + * UserGroup#freeGroup} * @return Resulting welcome message. * @see User * @see UserGroup @@ -62,9 +64,9 @@ public class TieredFeatureToggleVersion implements Service { } /** - * Method that checks if the welcome message to be returned is the enhanced version. For this instance as the logic - * is driven by the user group. This method is a little redundant. However can be used to show that there is an - * enhanced version available. + * Method that checks if the welcome message to be returned is the enhanced version. For this + * instance as the logic is driven by the user group. This method is a little redundant. However + * can be used to show that there is an enhanced version available. * * @return Boolean value {@code true} if enhanced. */ 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 263d5ce92..5c660ca59 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 @@ -24,7 +24,8 @@ package com.iluwatar.featuretoggle.user; /** - * Used to demonstrate the purpose of the feature toggle. This class actually has nothing to do with the pattern. + * Used to demonstrate the purpose of the feature toggle. This class actually has nothing to do with + * the pattern. */ public class User { @@ -41,7 +42,9 @@ public class User { /** * {@inheritDoc} - * @return The {@link String} representation of the User, in this case just return the name of the user. + * + * @return The {@link String} representation of the User, in this case just return the name of the + * user. */ @Override public String toString() { 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 40325041b..524ea6ef8 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 @@ -27,8 +27,9 @@ import java.util.ArrayList; import java.util.List; /** - * 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. + * 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 */ @@ -76,7 +77,6 @@ public class UserGroup { * Method to take a {@link User} to determine if the user is in the {@link UserGroup#paidGroup}. * * @param user {@link User} to check if they are in the {@link UserGroup#paidGroup} - * * @return true if the {@link User} is in {@link UserGroup#paidGroup} */ public static boolean isPaid(User user) { diff --git a/fluentinterface/src/main/java/com/iluwatar/fluentinterface/app/App.java b/fluentinterface/src/main/java/com/iluwatar/fluentinterface/app/App.java index 36766a568..b3f8fc0b6 100644 --- a/fluentinterface/src/main/java/com/iluwatar/fluentinterface/app/App.java +++ b/fluentinterface/src/main/java/com/iluwatar/fluentinterface/app/App.java @@ -23,39 +23,37 @@ package com.iluwatar.fluentinterface.app; +import static java.lang.String.valueOf; + import com.iluwatar.fluentinterface.fluentiterable.FluentIterable; import com.iluwatar.fluentinterface.fluentiterable.lazy.LazyFluentIterable; import com.iluwatar.fluentinterface.fluentiterable.simple.SimpleFluentIterable; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.StringJoiner; import java.util.function.Function; import java.util.function.Predicate; - -import static java.lang.String.valueOf; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * The Fluent Interface pattern is useful when you want to provide an easy readable, flowing API. * Those interfaces tend to mimic domain specific languages, so they can nearly be read as human * languages. - *

- * In this example two implementations of a {@link FluentIterable} interface are given. The + * + *

In this example two implementations of a {@link FluentIterable} interface are given. The * {@link SimpleFluentIterable} evaluates eagerly and would be too costly for real world * applications. The {@link LazyFluentIterable} is evaluated on termination. Their usage is * demonstrated with a simple number list that is filtered, transformed and collected. The result is * printed afterwards. - * */ public class App { private static final Logger LOGGER = LoggerFactory.getLogger(App.class); /** - * Program entry point + * Program entry point. */ public static void main(String[] args) { @@ -90,16 +88,16 @@ public class App { List lastTwoOfFirstFourStringMapped = LazyFluentIterable.from(integerList).filter(positives()).first(4).last(2) .map(number -> "String[" + valueOf(number) + "]").asList(); - prettyPrint( - "The lazy list contains the last two of the first four positive numbers mapped to Strings: ", - lastTwoOfFirstFourStringMapped); + prettyPrint("The lazy list contains the last two of the first four positive numbers " + + "mapped to Strings: ", lastTwoOfFirstFourStringMapped); LazyFluentIterable .from(integerList) .filter(negatives()) .first(2) .last() - .ifPresent(lastOfFirstTwo -> LOGGER.info("The last of the first two negatives is: {}", lastOfFirstTwo)); + .ifPresent(lastOfFirstTwo -> LOGGER + .info("The last of the first two negatives is: {}", lastOfFirstTwo)); } private static Function transformToString() { @@ -119,7 +117,7 @@ public class App { } private static void prettyPrint(String delimiter, String prefix, - Iterable iterable) { + Iterable iterable) { StringJoiner joiner = new StringJoiner(delimiter, prefix, "."); Iterator iterator = iterable.iterator(); while (iterator.hasNext()) { diff --git a/fluentinterface/src/main/java/com/iluwatar/fluentinterface/fluentiterable/FluentIterable.java b/fluentinterface/src/main/java/com/iluwatar/fluentinterface/fluentiterable/FluentIterable.java index 560934944..ea8d7c9bf 100644 --- a/fluentinterface/src/main/java/com/iluwatar/fluentinterface/fluentiterable/FluentIterable.java +++ b/fluentinterface/src/main/java/com/iluwatar/fluentinterface/fluentiterable/FluentIterable.java @@ -34,7 +34,7 @@ import java.util.function.Predicate; * The FluentIterable is a more convenient implementation of the common iterable interface based on * the fluent interface design pattern. This interface defines common operations, but doesn't aim to * be complete. It was inspired by Guava's com.google.common.collect.FluentIterable. - * + * * @param is the class of objects the iterable contains */ public interface FluentIterable extends Iterable { @@ -42,9 +42,9 @@ public interface FluentIterable extends Iterable { /** * Filters the contents of Iterable using the given predicate, leaving only the ones which satisfy * the predicate. - * + * * @param predicate the condition to test with for the filtering. If the test is negative, the - * tested object is removed by the iterator. + * tested object is removed by the iterator. * @return a filtered FluentIterable */ FluentIterable filter(Predicate predicate); @@ -52,53 +52,53 @@ public interface FluentIterable extends Iterable { /** * Returns an Optional containing the first element of this iterable if present, else returns * Optional.empty(). - * + * * @return the first element after the iteration is evaluated */ Optional first(); /** * Evaluates the iteration and leaves only the count first elements. - * + * * @return the first count elements as an Iterable */ FluentIterable first(int count); /** * Evaluates the iteration and returns the last element. This is a terminating operation. - * + * * @return the last element after the iteration is evaluated */ Optional last(); /** * Evaluates the iteration and leaves only the count last elements. - * + * * @return the last counts elements as an Iterable */ FluentIterable last(int count); /** * Transforms this FluentIterable into a new one containing objects of the type T. - * + * * @param function a function that transforms an instance of E into an instance of T - * @param the target type of the transformation + * @param the target type of the transformation * @return a new FluentIterable of the new type */ FluentIterable map(Function function); /** * Returns the contents of this Iterable as a List. - * + * * @return a List representation of this Iterable */ List asList(); /** * Utility method that iterates over iterable and adds the contents to a list. - * + * * @param iterable the iterable to collect - * @param the type of the objects to iterate + * @param the type of the objects to iterate * @return a list with all objects of the given iterator */ static List copyToList(Iterable iterable) { diff --git a/fluentinterface/src/main/java/com/iluwatar/fluentinterface/fluentiterable/lazy/DecoratingIterator.java b/fluentinterface/src/main/java/com/iluwatar/fluentinterface/fluentiterable/lazy/DecoratingIterator.java index 665c86446..711b54fc9 100644 --- a/fluentinterface/src/main/java/com/iluwatar/fluentinterface/fluentiterable/lazy/DecoratingIterator.java +++ b/fluentinterface/src/main/java/com/iluwatar/fluentinterface/fluentiterable/lazy/DecoratingIterator.java @@ -28,6 +28,7 @@ import java.util.Iterator; /** * This class is used to realize LazyFluentIterables. It decorates a given iterator. Does not * support consecutive hasNext() calls. + * * @param Iterable Collection of Elements of Type E */ public abstract class DecoratingIterator implements Iterator { diff --git a/fluentinterface/src/main/java/com/iluwatar/fluentinterface/fluentiterable/lazy/LazyFluentIterable.java b/fluentinterface/src/main/java/com/iluwatar/fluentinterface/fluentiterable/lazy/LazyFluentIterable.java index ca681b4e3..82173c513 100644 --- a/fluentinterface/src/main/java/com/iluwatar/fluentinterface/fluentiterable/lazy/LazyFluentIterable.java +++ b/fluentinterface/src/main/java/com/iluwatar/fluentinterface/fluentiterable/lazy/LazyFluentIterable.java @@ -23,6 +23,7 @@ package com.iluwatar.fluentinterface.fluentiterable.lazy; +import com.iluwatar.fluentinterface.fluentiterable.FluentIterable; import java.util.ArrayList; import java.util.Iterator; import java.util.List; @@ -30,12 +31,10 @@ import java.util.Optional; import java.util.function.Function; import java.util.function.Predicate; -import com.iluwatar.fluentinterface.fluentiterable.FluentIterable; - /** * This is a lazy implementation of the FluentIterable interface. It evaluates all chained * operations when a terminating operation is applied. - * + * * @param the type of the objects the iteration is about */ public class LazyFluentIterable implements FluentIterable { @@ -44,7 +43,7 @@ public class LazyFluentIterable implements FluentIterable { /** * This constructor creates a new LazyFluentIterable. It wraps the given iterable. - * + * * @param iterable the iterable this FluentIterable works on. */ protected LazyFluentIterable(Iterable iterable) { @@ -61,9 +60,9 @@ public class LazyFluentIterable implements FluentIterable { /** * Filters the contents of Iterable using the given predicate, leaving only the ones which satisfy * the predicate. - * + * * @param predicate the condition to test with for the filtering. If the test is negative, the - * tested object is removed by the iterator. + * tested object is removed by the iterator. * @return a new FluentIterable object that decorates the source iterable */ @Override @@ -90,7 +89,7 @@ public class LazyFluentIterable implements FluentIterable { /** * Can be used to collect objects from the iteration. Is a terminating operation. - * + * * @return an Optional containing the first object of this Iterable */ @Override @@ -101,10 +100,10 @@ public class LazyFluentIterable implements FluentIterable { /** * Can be used to collect objects from the iteration. - * + * * @param count defines the number of objects to return * @return the same FluentIterable with a collection decimated to a maximum of 'count' first - * objects. + * objects. */ @Override public FluentIterable first(int count) { @@ -130,7 +129,7 @@ public class LazyFluentIterable implements FluentIterable { /** * Can be used to collect objects from the iteration. Is a terminating operation. - * + * * @return an Optional containing the last object of this Iterable */ @Override @@ -143,10 +142,10 @@ public class LazyFluentIterable implements FluentIterable { * Can be used to collect objects from the Iterable. Is a terminating operation. This operation is * memory intensive, because the contents of this Iterable are collected into a List, when the * next object is requested. - * + * * @param count defines the number of objects to return * @return the same FluentIterable with a collection decimated to a maximum of 'count' last - * objects + * objects */ @Override public FluentIterable last(int count) { @@ -193,9 +192,9 @@ public class LazyFluentIterable implements FluentIterable { /** * Transforms this FluentIterable into a new one containing objects of the type T. - * + * * @param function a function that transforms an instance of E into an instance of T - * @param the target type of the transformation + * @param the target type of the transformation * @return a new FluentIterable of the new type */ @Override @@ -222,7 +221,7 @@ public class LazyFluentIterable implements FluentIterable { /** * Collects all remaining objects of this iteration into a list. - * + * * @return a list with all remaining objects of this iteration */ @Override @@ -241,9 +240,11 @@ public class LazyFluentIterable implements FluentIterable { } /** + * Constructors FluentIterable from given iterable. + * * @return a FluentIterable from a given iterable. Calls the LazyFluentIterable constructor. */ - public static final FluentIterable from(Iterable iterable) { + public static FluentIterable from(Iterable iterable) { return new LazyFluentIterable<>(iterable); } diff --git a/fluentinterface/src/main/java/com/iluwatar/fluentinterface/fluentiterable/simple/SimpleFluentIterable.java b/fluentinterface/src/main/java/com/iluwatar/fluentinterface/fluentiterable/simple/SimpleFluentIterable.java index 3b6bfa2b0..5165ca765 100644 --- a/fluentinterface/src/main/java/com/iluwatar/fluentinterface/fluentiterable/simple/SimpleFluentIterable.java +++ b/fluentinterface/src/main/java/com/iluwatar/fluentinterface/fluentiterable/simple/SimpleFluentIterable.java @@ -23,6 +23,7 @@ package com.iluwatar.fluentinterface.fluentiterable.simple; +import com.iluwatar.fluentinterface.fluentiterable.FluentIterable; import java.util.ArrayList; import java.util.Iterator; import java.util.List; @@ -32,12 +33,10 @@ import java.util.function.Consumer; import java.util.function.Function; import java.util.function.Predicate; -import com.iluwatar.fluentinterface.fluentiterable.FluentIterable; - /** * This is a simple implementation of the FluentIterable interface. It evaluates all chained * operations eagerly. This implementation would be costly to be utilized in real applications. - * + * * @param the type of the objects the iteration is about */ public class SimpleFluentIterable implements FluentIterable { @@ -46,7 +45,7 @@ public class SimpleFluentIterable implements FluentIterable { /** * This constructor creates a copy of a given iterable's contents. - * + * * @param iterable the iterable this interface copies to work on. */ protected SimpleFluentIterable(Iterable iterable) { @@ -56,9 +55,9 @@ public class SimpleFluentIterable implements FluentIterable { /** * Filters the contents of Iterable using the given predicate, leaving only the ones which satisfy * the predicate. - * + * * @param predicate the condition to test with for the filtering. If the test is negative, the - * tested object is removed by the iterator. + * tested object is removed by the iterator. * @return the same FluentIterable with a filtered collection */ @Override @@ -75,7 +74,7 @@ public class SimpleFluentIterable implements FluentIterable { /** * Can be used to collect objects from the Iterable. Is a terminating operation. - * + * * @return an option of the first object of the Iterable */ @Override @@ -86,10 +85,10 @@ public class SimpleFluentIterable implements FluentIterable { /** * Can be used to collect objects from the Iterable. Is a terminating operation. - * + * * @param count defines the number of objects to return * @return the same FluentIterable with a collection decimated to a maximum of 'count' first - * objects. + * objects. */ @Override public final FluentIterable first(int count) { @@ -107,7 +106,7 @@ public class SimpleFluentIterable implements FluentIterable { /** * Can be used to collect objects from the Iterable. Is a terminating operation. - * + * * @return an option of the last object of the Iterable */ @Override @@ -121,10 +120,10 @@ public class SimpleFluentIterable implements FluentIterable { /** * Can be used to collect objects from the Iterable. Is a terminating operation. - * + * * @param count defines the number of objects to return * @return the same FluentIterable with a collection decimated to a maximum of 'count' last - * objects + * objects */ @Override public final FluentIterable last(int count) { @@ -144,9 +143,9 @@ public class SimpleFluentIterable implements FluentIterable { /** * Transforms this FluentIterable into a new one containing objects of the type T. - * + * * @param function a function that transforms an instance of E into an instance of T - * @param the target type of the transformation + * @param the target type of the transformation * @return a new FluentIterable of the new type */ @Override @@ -161,7 +160,7 @@ public class SimpleFluentIterable implements FluentIterable { /** * Collects all remaining objects of this Iterable into a list. - * + * * @return a list with all remaining objects of this Iterable */ @Override @@ -170,6 +169,8 @@ public class SimpleFluentIterable implements FluentIterable { } /** + * Constructs FluentIterable from iterable. + * * @return a FluentIterable from a given iterable. Calls the SimpleFluentIterable constructor. */ public static FluentIterable from(Iterable iterable) { @@ -198,6 +199,8 @@ public class SimpleFluentIterable implements FluentIterable { } /** + * Find the count of remaining objects of current iterable. + * * @return the count of remaining objects of the current Iterable */ public final int getRemainingElementsCount() { @@ -212,7 +215,7 @@ public class SimpleFluentIterable implements FluentIterable { /** * Collects the remaining objects of the given iterator into a List. - * + * * @return a new List with the remaining objects. */ public static List toList(Iterator iterator) { diff --git a/flux/src/main/java/com/iluwatar/flux/action/Action.java b/flux/src/main/java/com/iluwatar/flux/action/Action.java index cb1de0c4a..6a5f608c2 100644 --- a/flux/src/main/java/com/iluwatar/flux/action/Action.java +++ b/flux/src/main/java/com/iluwatar/flux/action/Action.java @@ -24,9 +24,7 @@ package com.iluwatar.flux.action; /** - * * Action is the data payload dispatched to the stores when something happens. - * */ public abstract class Action { diff --git a/flux/src/main/java/com/iluwatar/flux/action/ActionType.java b/flux/src/main/java/com/iluwatar/flux/action/ActionType.java index 49a41689c..6399d2806 100644 --- a/flux/src/main/java/com/iluwatar/flux/action/ActionType.java +++ b/flux/src/main/java/com/iluwatar/flux/action/ActionType.java @@ -24,9 +24,7 @@ package com.iluwatar.flux.action; /** - * * Types of actions. - * */ public enum ActionType { diff --git a/flux/src/main/java/com/iluwatar/flux/action/Content.java b/flux/src/main/java/com/iluwatar/flux/action/Content.java index 8e4bf0fc1..59a63ec18 100644 --- a/flux/src/main/java/com/iluwatar/flux/action/Content.java +++ b/flux/src/main/java/com/iluwatar/flux/action/Content.java @@ -24,9 +24,7 @@ package com.iluwatar.flux.action; /** - * * Content items. - * */ public enum Content { diff --git a/flux/src/main/java/com/iluwatar/flux/action/ContentAction.java b/flux/src/main/java/com/iluwatar/flux/action/ContentAction.java index 977bdc344..3b29b6b4e 100644 --- a/flux/src/main/java/com/iluwatar/flux/action/ContentAction.java +++ b/flux/src/main/java/com/iluwatar/flux/action/ContentAction.java @@ -24,9 +24,7 @@ package com.iluwatar.flux.action; /** - * * ContentAction is a concrete action. - * */ public class ContentAction extends Action { diff --git a/flux/src/main/java/com/iluwatar/flux/action/MenuAction.java b/flux/src/main/java/com/iluwatar/flux/action/MenuAction.java index e357e7b0f..5ddeefde4 100644 --- a/flux/src/main/java/com/iluwatar/flux/action/MenuAction.java +++ b/flux/src/main/java/com/iluwatar/flux/action/MenuAction.java @@ -25,9 +25,7 @@ package com.iluwatar.flux.action; /** - * * MenuAction is a concrete action. - * */ public class MenuAction extends Action { diff --git a/flux/src/main/java/com/iluwatar/flux/action/MenuItem.java b/flux/src/main/java/com/iluwatar/flux/action/MenuItem.java index f7a35299a..f251e1dd7 100644 --- a/flux/src/main/java/com/iluwatar/flux/action/MenuItem.java +++ b/flux/src/main/java/com/iluwatar/flux/action/MenuItem.java @@ -24,9 +24,7 @@ package com.iluwatar.flux.action; /** - * * Menu items. - * */ public enum MenuItem { diff --git a/flux/src/main/java/com/iluwatar/flux/app/App.java b/flux/src/main/java/com/iluwatar/flux/app/App.java index 2f38bf070..13a16c977 100644 --- a/flux/src/main/java/com/iluwatar/flux/app/App.java +++ b/flux/src/main/java/com/iluwatar/flux/app/App.java @@ -31,26 +31,24 @@ import com.iluwatar.flux.view.ContentView; import com.iluwatar.flux.view.MenuView; /** - * * Flux is the application architecture that Facebook uses for building client-side web * applications. Flux eschews MVC in favor of a unidirectional data flow. When a user interacts with * a React view, the view propagates an action through a central dispatcher, to the various stores * that hold the application's data and business logic, which updates all of the views that are * affected. - *

- * This example has two views: menu and content. They represent typical main menu and content area - * of a web page. When menu item is clicked it triggers events through the dispatcher. The events - * are received and handled by the stores updating their data as needed. The stores then notify the - * views that they should rerender themselves. - *

- * http://facebook.github.io/flux/docs/overview.html * + *

This example has two views: menu and content. They represent typical main menu and content + * area of a web page. When menu item is clicked it triggers events through the dispatcher. The + * events are received and handled by the stores updating their data as needed. The stores then + * notify the views that they should rerender themselves. + * + *

http://facebook.github.io/flux/docs/overview.html */ public class App { /** - * Program entry point - * + * Program entry point. + * * @param args command line args */ public static void main(String[] args) { diff --git a/flux/src/main/java/com/iluwatar/flux/dispatcher/Dispatcher.java b/flux/src/main/java/com/iluwatar/flux/dispatcher/Dispatcher.java index ec8221c69..206ef8b3f 100644 --- a/flux/src/main/java/com/iluwatar/flux/dispatcher/Dispatcher.java +++ b/flux/src/main/java/com/iluwatar/flux/dispatcher/Dispatcher.java @@ -23,20 +23,17 @@ package com.iluwatar.flux.dispatcher; -import java.util.LinkedList; -import java.util.List; - import com.iluwatar.flux.action.Action; import com.iluwatar.flux.action.Content; import com.iluwatar.flux.action.ContentAction; import com.iluwatar.flux.action.MenuAction; import com.iluwatar.flux.action.MenuItem; import com.iluwatar.flux.store.Store; +import java.util.LinkedList; +import java.util.List; /** - * * Dispatcher sends Actions to registered Stores. - * */ public final class Dispatcher { @@ -44,7 +41,8 @@ public final class Dispatcher { private List stores = new LinkedList<>(); - private Dispatcher() {} + private Dispatcher() { + } public static Dispatcher getInstance() { return instance; @@ -55,7 +53,7 @@ public final class Dispatcher { } /** - * Menu item selected handler + * Menu item selected handler. */ public void menuItemSelected(MenuItem menuItem) { dispatchAction(new MenuAction(menuItem)); diff --git a/flux/src/main/java/com/iluwatar/flux/store/ContentStore.java b/flux/src/main/java/com/iluwatar/flux/store/ContentStore.java index 738179b6f..be2a5e419 100644 --- a/flux/src/main/java/com/iluwatar/flux/store/ContentStore.java +++ b/flux/src/main/java/com/iluwatar/flux/store/ContentStore.java @@ -29,9 +29,7 @@ import com.iluwatar.flux.action.Content; import com.iluwatar.flux.action.ContentAction; /** - * * ContentStore is a concrete store. - * */ public class ContentStore extends Store { diff --git a/flux/src/main/java/com/iluwatar/flux/store/MenuStore.java b/flux/src/main/java/com/iluwatar/flux/store/MenuStore.java index 04409be57..4757a563e 100644 --- a/flux/src/main/java/com/iluwatar/flux/store/MenuStore.java +++ b/flux/src/main/java/com/iluwatar/flux/store/MenuStore.java @@ -29,9 +29,7 @@ import com.iluwatar.flux.action.MenuAction; import com.iluwatar.flux.action.MenuItem; /** - * * MenuStore is a concrete store. - * */ public class MenuStore extends Store { diff --git a/flux/src/main/java/com/iluwatar/flux/store/Store.java b/flux/src/main/java/com/iluwatar/flux/store/Store.java index 5f4ca66c8..b0fc8bac0 100644 --- a/flux/src/main/java/com/iluwatar/flux/store/Store.java +++ b/flux/src/main/java/com/iluwatar/flux/store/Store.java @@ -23,16 +23,13 @@ package com.iluwatar.flux.store; +import com.iluwatar.flux.action.Action; +import com.iluwatar.flux.view.View; import java.util.LinkedList; import java.util.List; -import com.iluwatar.flux.action.Action; -import com.iluwatar.flux.view.View; - /** - * * Store is a data model. - * */ public abstract class Store { diff --git a/flux/src/main/java/com/iluwatar/flux/view/ContentView.java b/flux/src/main/java/com/iluwatar/flux/view/ContentView.java index fad14d467..fc794d8dc 100644 --- a/flux/src/main/java/com/iluwatar/flux/view/ContentView.java +++ b/flux/src/main/java/com/iluwatar/flux/view/ContentView.java @@ -30,9 +30,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** - * * ContentView is a concrete view. - * */ public class ContentView implements View { diff --git a/flux/src/main/java/com/iluwatar/flux/view/MenuView.java b/flux/src/main/java/com/iluwatar/flux/view/MenuView.java index 80d33de19..c09d146a9 100644 --- a/flux/src/main/java/com/iluwatar/flux/view/MenuView.java +++ b/flux/src/main/java/com/iluwatar/flux/view/MenuView.java @@ -31,9 +31,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** - * * MenuView is a concrete view. - * */ public class MenuView implements View { diff --git a/flux/src/main/java/com/iluwatar/flux/view/View.java b/flux/src/main/java/com/iluwatar/flux/view/View.java index 5496cd684..94a3bfd09 100644 --- a/flux/src/main/java/com/iluwatar/flux/view/View.java +++ b/flux/src/main/java/com/iluwatar/flux/view/View.java @@ -26,9 +26,7 @@ package com.iluwatar.flux.view; import com.iluwatar.flux.store.Store; /** - * * Views define the representation of data. - * */ public interface View { diff --git a/flyweight/src/main/java/com/iluwatar/flyweight/AlchemistShop.java b/flyweight/src/main/java/com/iluwatar/flyweight/AlchemistShop.java index 78f01474f..e99cfc807 100644 --- a/flyweight/src/main/java/com/iluwatar/flyweight/AlchemistShop.java +++ b/flyweight/src/main/java/com/iluwatar/flyweight/AlchemistShop.java @@ -23,16 +23,13 @@ package com.iluwatar.flyweight; +import java.util.Collections; +import java.util.List; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.Collections; -import java.util.List; - /** - * * AlchemistShop holds potions on its shelves. It uses PotionFactory to provide the potions. - * */ public class AlchemistShop { @@ -42,31 +39,31 @@ public class AlchemistShop { private List bottomShelf; /** - * Constructor + * Constructor. */ public AlchemistShop() { PotionFactory factory = new PotionFactory(); topShelf = List.of( - factory.createPotion(PotionType.INVISIBILITY), - factory.createPotion(PotionType.INVISIBILITY), - factory.createPotion(PotionType.STRENGTH), - factory.createPotion(PotionType.HEALING), - factory.createPotion(PotionType.INVISIBILITY), - factory.createPotion(PotionType.STRENGTH), - factory.createPotion(PotionType.HEALING), - factory.createPotion(PotionType.HEALING) + factory.createPotion(PotionType.INVISIBILITY), + factory.createPotion(PotionType.INVISIBILITY), + factory.createPotion(PotionType.STRENGTH), + factory.createPotion(PotionType.HEALING), + factory.createPotion(PotionType.INVISIBILITY), + factory.createPotion(PotionType.STRENGTH), + factory.createPotion(PotionType.HEALING), + factory.createPotion(PotionType.HEALING) ); bottomShelf = List.of( - factory.createPotion(PotionType.POISON), - factory.createPotion(PotionType.POISON), - factory.createPotion(PotionType.POISON), - factory.createPotion(PotionType.HOLY_WATER), - factory.createPotion(PotionType.HOLY_WATER) + factory.createPotion(PotionType.POISON), + factory.createPotion(PotionType.POISON), + factory.createPotion(PotionType.POISON), + factory.createPotion(PotionType.HOLY_WATER), + factory.createPotion(PotionType.HOLY_WATER) ); } /** - * Get a read-only list of all the items on the top shelf + * Get a read-only list of all the items on the top shelf. * * @return The top shelf potions */ @@ -75,7 +72,7 @@ public class AlchemistShop { } /** - * Get a read-only list of all the items on the bottom shelf + * Get a read-only list of all the items on the bottom shelf. * * @return The bottom shelf potions */ @@ -84,7 +81,7 @@ public class AlchemistShop { } /** - * Enumerate potions + * Enumerate potions. */ public void enumerate() { diff --git a/flyweight/src/main/java/com/iluwatar/flyweight/App.java b/flyweight/src/main/java/com/iluwatar/flyweight/App.java index b93d8d6c5..cbea6b9cc 100644 --- a/flyweight/src/main/java/com/iluwatar/flyweight/App.java +++ b/flyweight/src/main/java/com/iluwatar/flyweight/App.java @@ -24,24 +24,22 @@ package com.iluwatar.flyweight; /** - * * Flyweight pattern is useful when the program needs a huge amount of objects. It provides means to * decrease resource usage by sharing object instances. - *

- * In this example {@link AlchemistShop} has great amount of potions on its shelves. To fill the + * + *

In this example {@link AlchemistShop} has great amount of potions on its shelves. To fill the * shelves {@link AlchemistShop} uses {@link PotionFactory} (which represents the Flyweight in this * example). Internally {@link PotionFactory} holds a map of the potions and lazily creates new ones * when requested. - *

- * To enable safe sharing, between clients and threads, Flyweight objects must be immutable. + * + *

To enable safe sharing, between clients and threads, Flyweight objects must be immutable. * Flyweight objects are by definition value objects. - * */ public class App { /** - * Program entry point - * + * Program entry point. + * * @param args command line args */ public static void main(String[] args) { diff --git a/flyweight/src/main/java/com/iluwatar/flyweight/HealingPotion.java b/flyweight/src/main/java/com/iluwatar/flyweight/HealingPotion.java index af0fb95b4..8a02b7007 100644 --- a/flyweight/src/main/java/com/iluwatar/flyweight/HealingPotion.java +++ b/flyweight/src/main/java/com/iluwatar/flyweight/HealingPotion.java @@ -27,9 +27,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** - * - * HealingPotion - * + * HealingPotion. */ public class HealingPotion implements Potion { diff --git a/flyweight/src/main/java/com/iluwatar/flyweight/HolyWaterPotion.java b/flyweight/src/main/java/com/iluwatar/flyweight/HolyWaterPotion.java index c5426bf53..ebe0c88d4 100644 --- a/flyweight/src/main/java/com/iluwatar/flyweight/HolyWaterPotion.java +++ b/flyweight/src/main/java/com/iluwatar/flyweight/HolyWaterPotion.java @@ -27,9 +27,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** - * - * HolyWaterPotion - * + * HolyWaterPotion. */ public class HolyWaterPotion implements Potion { diff --git a/flyweight/src/main/java/com/iluwatar/flyweight/InvisibilityPotion.java b/flyweight/src/main/java/com/iluwatar/flyweight/InvisibilityPotion.java index 922f921dd..3a3b2d638 100644 --- a/flyweight/src/main/java/com/iluwatar/flyweight/InvisibilityPotion.java +++ b/flyweight/src/main/java/com/iluwatar/flyweight/InvisibilityPotion.java @@ -27,9 +27,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** - * - * InvisibilityPotion - * + * InvisibilityPotion. */ public class InvisibilityPotion implements Potion { diff --git a/flyweight/src/main/java/com/iluwatar/flyweight/PoisonPotion.java b/flyweight/src/main/java/com/iluwatar/flyweight/PoisonPotion.java index 4ba9b0719..4641e7986 100644 --- a/flyweight/src/main/java/com/iluwatar/flyweight/PoisonPotion.java +++ b/flyweight/src/main/java/com/iluwatar/flyweight/PoisonPotion.java @@ -27,9 +27,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** - * - * PoisonPotion - * + * PoisonPotion. */ public class PoisonPotion implements Potion { diff --git a/flyweight/src/main/java/com/iluwatar/flyweight/Potion.java b/flyweight/src/main/java/com/iluwatar/flyweight/Potion.java index 4fc1b5dbd..ac89dd1bb 100644 --- a/flyweight/src/main/java/com/iluwatar/flyweight/Potion.java +++ b/flyweight/src/main/java/com/iluwatar/flyweight/Potion.java @@ -24,9 +24,7 @@ package com.iluwatar.flyweight; /** - * * Interface for Potions. - * */ public interface Potion { diff --git a/flyweight/src/main/java/com/iluwatar/flyweight/PotionFactory.java b/flyweight/src/main/java/com/iluwatar/flyweight/PotionFactory.java index 843bf2717..19edf0e21 100644 --- a/flyweight/src/main/java/com/iluwatar/flyweight/PotionFactory.java +++ b/flyweight/src/main/java/com/iluwatar/flyweight/PotionFactory.java @@ -27,11 +27,9 @@ import java.util.EnumMap; import java.util.Map; /** - * * PotionFactory is the Flyweight in this example. It minimizes memory use by sharing object * instances. It holds a map of potion instances and new potions are created only when none of the * type already exists. - * */ public class PotionFactory { diff --git a/flyweight/src/main/java/com/iluwatar/flyweight/PotionType.java b/flyweight/src/main/java/com/iluwatar/flyweight/PotionType.java index 04650206a..84cf5fbc0 100644 --- a/flyweight/src/main/java/com/iluwatar/flyweight/PotionType.java +++ b/flyweight/src/main/java/com/iluwatar/flyweight/PotionType.java @@ -24,9 +24,7 @@ package com.iluwatar.flyweight; /** - * * Enumeration for potion types. - * */ public enum PotionType { diff --git a/flyweight/src/main/java/com/iluwatar/flyweight/StrengthPotion.java b/flyweight/src/main/java/com/iluwatar/flyweight/StrengthPotion.java index 60dc8bc39..c8011b4f7 100644 --- a/flyweight/src/main/java/com/iluwatar/flyweight/StrengthPotion.java +++ b/flyweight/src/main/java/com/iluwatar/flyweight/StrengthPotion.java @@ -27,9 +27,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** - * - * StrengthPotion - * + * StrengthPotion. */ public class StrengthPotion implements Potion { diff --git a/front-controller/src/main/java/com/iluwatar/front/controller/App.java b/front-controller/src/main/java/com/iluwatar/front/controller/App.java index 949182eb2..7388a06f8 100644 --- a/front-controller/src/main/java/com/iluwatar/front/controller/App.java +++ b/front-controller/src/main/java/com/iluwatar/front/controller/App.java @@ -24,30 +24,27 @@ package com.iluwatar.front.controller; /** - * * The Front Controller is a presentation tier pattern. Essentially it defines a controller that * handles all requests for a web site. - *

- * The Front Controller pattern consolidates request handling through a single handler object ( + * + *

The Front Controller pattern consolidates request handling through a single handler object ( * {@link FrontController}). This object can carry out the common the behavior such as * authorization, request logging and routing requests to corresponding views. - *

- * Typically the requests are mapped to command objects ({@link Command}) which then display the - * correct view ({@link View}). - *

- * In this example we have implemented two views: {@link ArcherView} and {@link CatapultView}. These - * are displayed by sending correct request to the {@link FrontController} object. For example, the - * {@link ArcherView} gets displayed when {@link FrontController} receives request "Archer". When - * the request is unknown, we display the error view ({@link ErrorView}). * + *

Typically the requests are mapped to command objects ({@link Command}) which then display the + * correct view ({@link View}). + * + *

In this example we have implemented two views: {@link ArcherView} and {@link CatapultView}. + * These are displayed by sending correct request to the {@link FrontController} object. For + * example, the {@link ArcherView} gets displayed when {@link FrontController} receives request + * "Archer". When the request is unknown, we display the error view ({@link ErrorView}). */ public class App { /** - * Program entry point - * - * @param args - * command line args + * Program entry point. + * + * @param args command line args */ public static void main(String[] args) { FrontController controller = new FrontController(); diff --git a/front-controller/src/main/java/com/iluwatar/front/controller/ApplicationException.java b/front-controller/src/main/java/com/iluwatar/front/controller/ApplicationException.java index 58cacdb73..46949f879 100644 --- a/front-controller/src/main/java/com/iluwatar/front/controller/ApplicationException.java +++ b/front-controller/src/main/java/com/iluwatar/front/controller/ApplicationException.java @@ -24,9 +24,7 @@ package com.iluwatar.front.controller; /** - * - * Custom exception type - * + * Custom exception type. */ public class ApplicationException extends RuntimeException { diff --git a/front-controller/src/main/java/com/iluwatar/front/controller/ArcherCommand.java b/front-controller/src/main/java/com/iluwatar/front/controller/ArcherCommand.java index 312565cc6..46509476d 100644 --- a/front-controller/src/main/java/com/iluwatar/front/controller/ArcherCommand.java +++ b/front-controller/src/main/java/com/iluwatar/front/controller/ArcherCommand.java @@ -24,9 +24,7 @@ package com.iluwatar.front.controller; /** - * * Command for archers. - * */ public class ArcherCommand implements Command { diff --git a/front-controller/src/main/java/com/iluwatar/front/controller/ArcherView.java b/front-controller/src/main/java/com/iluwatar/front/controller/ArcherView.java index eecc79a32..d767dd80f 100644 --- a/front-controller/src/main/java/com/iluwatar/front/controller/ArcherView.java +++ b/front-controller/src/main/java/com/iluwatar/front/controller/ArcherView.java @@ -27,12 +27,10 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** - * * View for archers. - * */ public class ArcherView implements View { - + private static final Logger LOGGER = LoggerFactory.getLogger(ArcherView.class); @Override diff --git a/front-controller/src/main/java/com/iluwatar/front/controller/CatapultCommand.java b/front-controller/src/main/java/com/iluwatar/front/controller/CatapultCommand.java index 0a8142af3..29f66502a 100644 --- a/front-controller/src/main/java/com/iluwatar/front/controller/CatapultCommand.java +++ b/front-controller/src/main/java/com/iluwatar/front/controller/CatapultCommand.java @@ -24,9 +24,7 @@ package com.iluwatar.front.controller; /** - * * Command for catapults. - * */ public class CatapultCommand implements Command { diff --git a/front-controller/src/main/java/com/iluwatar/front/controller/CatapultView.java b/front-controller/src/main/java/com/iluwatar/front/controller/CatapultView.java index 148d21594..58cbf282c 100644 --- a/front-controller/src/main/java/com/iluwatar/front/controller/CatapultView.java +++ b/front-controller/src/main/java/com/iluwatar/front/controller/CatapultView.java @@ -27,9 +27,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** - * * View for catapults. - * */ public class CatapultView implements View { diff --git a/front-controller/src/main/java/com/iluwatar/front/controller/Command.java b/front-controller/src/main/java/com/iluwatar/front/controller/Command.java index 573b98aa8..04d42f4f2 100644 --- a/front-controller/src/main/java/com/iluwatar/front/controller/Command.java +++ b/front-controller/src/main/java/com/iluwatar/front/controller/Command.java @@ -24,9 +24,7 @@ package com.iluwatar.front.controller; /** - * * Commands are the intermediary between requests and views. - * */ public interface Command { diff --git a/front-controller/src/main/java/com/iluwatar/front/controller/ErrorView.java b/front-controller/src/main/java/com/iluwatar/front/controller/ErrorView.java index 33806cba9..c7c012a31 100644 --- a/front-controller/src/main/java/com/iluwatar/front/controller/ErrorView.java +++ b/front-controller/src/main/java/com/iluwatar/front/controller/ErrorView.java @@ -27,9 +27,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** - * * View for errors. - * */ public class ErrorView implements View { diff --git a/front-controller/src/main/java/com/iluwatar/front/controller/FrontController.java b/front-controller/src/main/java/com/iluwatar/front/controller/FrontController.java index 1c81b9354..91535f9e0 100644 --- a/front-controller/src/main/java/com/iluwatar/front/controller/FrontController.java +++ b/front-controller/src/main/java/com/iluwatar/front/controller/FrontController.java @@ -24,10 +24,8 @@ package com.iluwatar.front.controller; /** - * * FrontController is the handler class that takes in all the requests and renders the correct * response. - * */ public class FrontController { diff --git a/front-controller/src/main/java/com/iluwatar/front/controller/UnknownCommand.java b/front-controller/src/main/java/com/iluwatar/front/controller/UnknownCommand.java index 652eee02f..b03a3dd1f 100644 --- a/front-controller/src/main/java/com/iluwatar/front/controller/UnknownCommand.java +++ b/front-controller/src/main/java/com/iluwatar/front/controller/UnknownCommand.java @@ -24,9 +24,7 @@ package com.iluwatar.front.controller; /** - * * Default command in case the mapping is not successful. - * */ public class UnknownCommand implements Command { diff --git a/front-controller/src/main/java/com/iluwatar/front/controller/View.java b/front-controller/src/main/java/com/iluwatar/front/controller/View.java index e5d020801..8b46637d3 100644 --- a/front-controller/src/main/java/com/iluwatar/front/controller/View.java +++ b/front-controller/src/main/java/com/iluwatar/front/controller/View.java @@ -24,9 +24,7 @@ package com.iluwatar.front.controller; /** - * * Views are the representations rendered for the user. - * */ public interface View {