Resolves checkstyle errors for feature-toggle fluentinterface flux flyweight front-controller (#1078)

* Reduces checkstyle errors in feature-toggle

* Reduces checkstyle errors in fluentinterface

* Reduces checkstyle errors in flux

* Reduces checkstyle errors in flyweight

* Reduces checkstyle errors in front-controller
This commit is contained in:
Anurag Agarwal
2019-11-12 01:54:23 +05:30
committed by Ilkka Seppälä
parent c954a436ad
commit 37599eb48f
46 changed files with 197 additions and 258 deletions

View File

@ -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<Potion> 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() {

View File

@ -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.
* <p>
* In this example {@link AlchemistShop} has great amount of potions on its shelves. To fill the
*
* <p>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.
* <p>
* To enable safe sharing, between clients and threads, Flyweight objects must be immutable.
*
* <p>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) {

View File

@ -27,9 +27,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
*
* HealingPotion
*
* HealingPotion.
*/
public class HealingPotion implements Potion {

View File

@ -27,9 +27,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
*
* HolyWaterPotion
*
* HolyWaterPotion.
*/
public class HolyWaterPotion implements Potion {

View File

@ -27,9 +27,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
*
* InvisibilityPotion
*
* InvisibilityPotion.
*/
public class InvisibilityPotion implements Potion {

View File

@ -27,9 +27,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
*
* PoisonPotion
*
* PoisonPotion.
*/
public class PoisonPotion implements Potion {

View File

@ -24,9 +24,7 @@
package com.iluwatar.flyweight;
/**
*
* Interface for Potions.
*
*/
public interface Potion {

View File

@ -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 {

View File

@ -24,9 +24,7 @@
package com.iluwatar.flyweight;
/**
*
* Enumeration for potion types.
*
*/
public enum PotionType {

View File

@ -27,9 +27,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
*
* StrengthPotion
*
* StrengthPotion.
*/
public class StrengthPotion implements Potion {