diff options
Diffstat (limited to 'openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/commands/CommandsHolder.java')
-rw-r--r-- | openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/commands/CommandsHolder.java | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/commands/CommandsHolder.java b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/commands/CommandsHolder.java index 1c632a6ccf..3984ec702b 100644 --- a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/commands/CommandsHolder.java +++ b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/commands/CommandsHolder.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,7 +17,6 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.openecomp.core.tools.commands; import static org.openecomp.core.tools.commands.Command.COMMAND_OPTION; @@ -43,11 +42,10 @@ public class CommandsHolder { private static final Map<CommandName, Command> COMMANDS = new EnumMap<>(CommandName.class); static { - OPTIONS.addOption( - Option.builder(COMMAND_OPTION).hasArg().argName("command").desc("command name, mandatory").build()); + OPTIONS.addOption(Option.builder(COMMAND_OPTION).hasArg().argName("command").desc("command name, mandatory").build()); registerCommands(); } - + private CommandsHolder() { } @@ -65,9 +63,8 @@ public class CommandsHolder { public static Optional<Command> getCommand(String[] args) { CommandLine cmd = parseArgs(args); - return cmd == null || !cmd.hasOption(COMMAND_OPTION) || cmd.getOptionValue(COMMAND_OPTION) == null - ? Optional.empty() - : getCommandName(cmd.getOptionValue(COMMAND_OPTION)).map(COMMANDS::get); + return cmd == null || !cmd.hasOption(COMMAND_OPTION) || cmd.getOptionValue(COMMAND_OPTION) == null ? Optional.empty() + : getCommandName(cmd.getOptionValue(COMMAND_OPTION)).map(COMMANDS::get); } public static void printUsages() { @@ -95,8 +92,7 @@ public class CommandsHolder { static void addCommand(Command command) { CommandName commandName = command.getCommandName(); if (COMMANDS.containsKey(commandName)) { - throw new IllegalArgumentException( - String.format("Command with the name %s was already registered", commandName)); + throw new IllegalArgumentException(String.format("Command with the name %s was already registered", commandName)); } COMMANDS.put(commandName, command); } |