From 3493cfbfe6e815454ce102a32152b088b89c5308 Mon Sep 17 00:00:00 2001
From: Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Tue, 20 Jan 2015 10:51:36 +0000
Subject: [PATCH] Removed the fields that SubCommandArgumentParser duplicates from superclass ArgumentParser.
---
opendj-cli/src/main/java/com/forgerock/opendj/cli/SubCommandArgumentParser.java | 32 +++-----------------------------
1 files changed, 3 insertions(+), 29 deletions(-)
diff --git a/opendj-cli/src/main/java/com/forgerock/opendj/cli/SubCommandArgumentParser.java b/opendj-cli/src/main/java/com/forgerock/opendj/cli/SubCommandArgumentParser.java
index 3d3e9bd..243360a 100644
--- a/opendj-cli/src/main/java/com/forgerock/opendj/cli/SubCommandArgumentParser.java
+++ b/opendj-cli/src/main/java/com/forgerock/opendj/cli/SubCommandArgumentParser.java
@@ -45,7 +45,6 @@
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.LocalizableMessageBuilder;
-import org.forgerock.i18n.slf4j.LocalizedLogger;
/**
* This class defines a variant of the argument parser that can be used with applications that use subcommands to
@@ -57,14 +56,11 @@
*/
public class SubCommandArgumentParser extends ArgumentParser {
- private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
private static final String INDENT = " ";
/** The arguments that will be used to trigger the display of usage information for groups of sub-commands. */
private final Map<Argument, Collection<SubCommand>> usageGroupArguments =
new HashMap<Argument, Collection<SubCommand>>();
- /** The set of unnamed trailing arguments that were provided for this parser. */
- private final ArrayList<String> trailingArguments = new ArrayList<String>();
/** The set of global arguments defined for this parser, referenced by short ID. */
private final Map<Character, Argument> globalShortIDMap = new HashMap<Character, Argument>();
@@ -77,8 +73,6 @@
/** The set of subcommands defined for this parser, referenced by subcommand name. */
private final SortedMap<String, SubCommand> subCommands = new TreeMap<String, SubCommand>();
- /** The raw set of command-line arguments that were provided. */
- private String[] rawArguments;
/**The subcommand requested by the user as part of the command-line arguments. */
private SubCommand subCommand;
@@ -238,17 +232,6 @@
}
/**
- * Retrieves the raw set of arguments that were provided.
- *
- * @return The raw set of arguments that were provided, or <CODE>null</CODE> if the argument list has not yet been
- * parsed.
- */
- @Override
- public String[] getRawArguments() {
- return rawArguments;
- }
-
- /**
* Adds the provided argument to the set of global arguments handled by this parser.
*
* @param argument
@@ -460,9 +443,10 @@
*/
@Override
public void parseArguments(String[] rawArguments, Properties argumentProperties) throws ArgumentException {
- this.rawArguments = rawArguments;
+ setRawArguments(rawArguments);
this.subCommand = null;
- this.trailingArguments.clear();
+ final ArrayList<String> trailingArguments = getTrailingArguments();
+ trailingArguments.clear();
setUsageOrVersionDisplayed(false);
boolean inTrailingArgs = false;
@@ -956,16 +940,6 @@
}
/**
- * Retrieves the set of unnamed trailing arguments that were provided on the command line.
- *
- * @return The set of unnamed trailing arguments that were provided on the command line.
- */
- @Override
- public ArrayList<String> getTrailingArguments() {
- return trailingArguments;
- }
-
- /**
* Adds the provided subcommand to this argument parser. This is only intended for use by the
* <CODE>SubCommand</CODE> constructor and does not do any validation of its own to ensure that there are no
* conflicts with the subcommand or any of its arguments.
--
Gitblit v1.10.0