org.apache.commons.cli.Options Maven / Gradle / Ivy
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.commons.cli;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
/**
* Main entry-point into the library.
*
* Options represents a collection of {@link Option} objects, which
* describe the possible options for a command-line.
*
* It may flexibly parse long and short options, with or without
* values. Additionally, it may parse only a portion of a commandline,
* allowing for flexible multi-stage parsing.
*
* @see org.apache.commons.cli.CommandLine
*
* @version $Id: Options.java 1685376 2015-06-14 09:51:59Z britter $
*/
public class Options implements Serializable
{
/** The serial version UID. */
private static final long serialVersionUID = 1L;
/** a map of the options with the character key */
private final Map shortOpts = new LinkedHashMap();
/** a map of the options with the long key */
private final Map longOpts = new LinkedHashMap();
/** a map of the required options */
// N.B. This can contain either a String (addOption) or an OptionGroup (addOptionGroup)
// TODO this seems wrong
private final List