Resolves checkstyle errors for remaining m (#1090)

* Reduces checkstyle errors in marker

* Reduces checkstyle errors in master-worker-pattern

* Reduces checkstyle errors in mediator

* Reduces checkstyle errors in memento

* Reduces checkstyle errors in model-view-controller

* Reduces checkstyle errors in model-view-presenter

* Reduces checkstyle errors in module

* Reduces checkstyle errors in monad

* Reduces checkstyle errors in monostate

* Reduces checkstyle errors in multiton

* Reduces checkstyle errors in mute-idiom

* Reduces checkstyle errors in mutex
This commit is contained in:
Anurag Agarwal
2019-11-16 18:18:23 +05:30
committed by Ilkka Seppälä
parent 3ccc9baa1a
commit 1fdc650545
66 changed files with 374 additions and 423 deletions

View File

@ -27,26 +27,24 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
*
* Whereas Singleton design pattern introduces single globally accessible object the Multiton
* pattern defines many globally accessible objects. The client asks for the correct instance from
* the Multiton by passing an enumeration as parameter.
* <p>
* There is more than one way to implement the multiton design pattern. In the first example
* {@link Nazgul} is the Multiton and we can ask single {@link Nazgul} from it using {@link NazgulName}.
* The {@link Nazgul}s are statically initialized and stored in concurrent hash map.
* <p>
* In the enum implementation {@link NazgulEnum} is the multiton. It is static and mutable because
* of the way java supports enums.
*
* <p>There is more than one way to implement the multiton design pattern. In the first example
* {@link Nazgul} is the Multiton and we can ask single {@link Nazgul} from it using {@link
* NazgulName}. The {@link Nazgul}s are statically initialized and stored in concurrent hash map.
*
* <p>In the enum implementation {@link NazgulEnum} is the multiton. It is static and mutable
* because of the way java supports enums.
*/
public class App {
private static final Logger LOGGER = LoggerFactory.getLogger(App.class);
/**
* Program entry point
*
* Program entry point.
*
* @param args command line args
*/
public static void main(String[] args) {
@ -60,7 +58,7 @@ public class App {
LOGGER.info("ADUNAPHEL={}", Nazgul.getInstance(NazgulName.ADUNAPHEL));
LOGGER.info("REN={}", Nazgul.getInstance(NazgulName.REN));
LOGGER.info("UVATHA={}", Nazgul.getInstance(NazgulName.UVATHA));
// enum multiton
LOGGER.info("KHAMUL={}", NazgulEnum.KHAMUL);
LOGGER.info("MURAZOR={}", NazgulEnum.MURAZOR);

View File

@ -27,9 +27,7 @@ import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
/**
*
* Nazgul is a Multiton class. Nazgul instances can be queried using {@link #getInstance} method.
*
*/
public final class Nazgul {

View File

@ -24,11 +24,10 @@
package com.iluwatar.multiton;
/**
* enum based multiton implementation
*
* enum based multiton implementation.
*/
public enum NazgulEnum {
KHAMUL, MURAZOR, DWAR, JI_INDUR, AKHORAHIL, HOARMURATH, ADUNAPHEL, REN, UVATHA;
}

View File

@ -24,9 +24,7 @@
package com.iluwatar.multiton;
/**
*
* Each Nazgul has different {@link NazgulName}.
*
*/
public enum NazgulName {