package com.github.vovas11.courses.command;

import java.util.HashMap;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

/**
 * {@code CommandFactory} is a factory (design pattern) that stores all commands
 * needed for handling user forms and returns one of commands when it needed
 * 
 * @author vovas11
 * @see Command
 */
public class CommandFactory {

    /* represents one instance of the CommandFactory (Singleton) */
    static CommandFactory commandFactory = new CommandFactory();

    /* stores all commands */
    Map<String, Command> commandMap = new HashMap<>();

    /* Private Constructor does not allow creating instances except by this class */
    private CommandFactory() {
	commandMap.put("registration", new RegistrationCommand());
	commandMap.put("login", new LoginCommand());
	commandMap.put("courseselect", new CourseSelectCommand());
	commandMap.put("logout", new LogoutCommand());
    }

    /**
     * Provides the access to the single instance of the class
     * @return the link to the {@code CommandFactory} instance
     */
    public static CommandFactory getInstance() {
	return commandFactory;
    }

    /**
     * Delivers an object of the command the name of which is sent inside the HTTP request
     * 
     * @param   request   HTTP request from the servlet
     * @return the single instance of the {@code Command}
     */
    public Command getCommand(HttpServletRequest request) {
	String value = request.getParameter("ok");
	return commandMap.get(value);
    }
}
@@ -308,17 +308,16 @@
 eded%0D%0A *
- 
 %0D%0A * @au
@@ -458,16 +458,24 @@
 */%0D%0A    
+private 
 static C
@@ -565,16 +565,24 @@
 */%0D%0A    
+private 
 Map%3CStri
@@ -631,94 +631,8 @@
 %0D%0A%0D%0A
-    /* Private Constructor does not allow creating instances except by this class */%0D%0A
     
@@ -659,17 +659,24 @@
 ry() %7B%0D%0A
-%09
+        
 commandM
@@ -719,33 +719,40 @@
 ionCommand());%0D%0A
-%09
+        
 commandMap.put(%22
@@ -773,33 +773,40 @@
 ginCommand());%0D%0A
-%09
+        
 commandMap.put(%22
@@ -849,17 +849,24 @@
 nd());%0D%0A
-%09
+        
 commandM
@@ -1110,17 +1110,24 @@
 ce() %7B%0D%0A
-%09
+        
 return c
@@ -1258,17 +1258,16 @@
 %0D%0A     *
- 
 %0D%0A     *
@@ -1446,17 +1446,24 @@
 est) %7B%0D%0A
-%09
+        
 String v
@@ -1502,9 +1502,16 @@
 );%0D%0A
-%09
+        
 retu

Change the IDE and update CommandFactoy.java