Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolves checkstyle errors for remaining m #1090

Merged
merged 12 commits into from
Nov 16, 2019
Merged
Prev Previous commit
Next Next commit
Reduces checkstyle errors in multiton
  • Loading branch information
anuragagarwal561994 committed Nov 15, 2019
commit c2dd5d67c3e500bdf286a78f6c0f83b08e42bbbb
20 changes: 9 additions & 11 deletions multiton/src/main/java/com/iluwatar/multiton/App.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,26 +27,24 @@
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) {
Expand All @@ -60,7 +58,7 @@ public static void main(String[] args) {
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);
Expand Down
2 changes: 0 additions & 2 deletions multiton/src/main/java/com/iluwatar/multiton/Nazgul.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,7 @@
import java.util.concurrent.ConcurrentHashMap;

/**
*
* Nazgul is a Multiton class. Nazgul instances can be queried using {@link #getInstance} method.
*
*/
public final class Nazgul {

Expand Down
5 changes: 2 additions & 3 deletions multiton/src/main/java/com/iluwatar/multiton/NazgulEnum.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;

}
2 changes: 0 additions & 2 deletions multiton/src/main/java/com/iluwatar/multiton/NazgulName.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@
package com.iluwatar.multiton;

/**
*
* Each Nazgul has different {@link NazgulName}.
*
*/
public enum NazgulName {

Expand Down