You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by jk...@apache.org on 2003/05/24 20:02:49 UTC

cvs commit: jakarta-commons/cli/src/java/org/apache/commons/cli CommandLine.java

jkeyes      2003/05/24 11:02:49

  Modified:    cli/src/java/org/apache/commons/cli Tag: cli_1_x
                        CommandLine.java
  Log:
  added Javadoc
  added license
  replaced tabs with spaces
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.17.2.3  +175 -17   jakarta-commons/cli/src/java/org/apache/commons/cli/CommandLine.java
  
  Index: CommandLine.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/cli/src/java/org/apache/commons/cli/CommandLine.java,v
  retrieving revision 1.17.2.2
  retrieving revision 1.17.2.3
  diff -u -r1.17.2.2 -r1.17.2.3
  --- CommandLine.java	24 May 2003 17:25:03 -0000	1.17.2.2
  +++ CommandLine.java	24 May 2003 18:02:49 -0000	1.17.2.3
  @@ -1,3 +1,63 @@
  +/*
  + * $Header$
  + * $Revision$
  + * $Date$
  + *
  + * ====================================================================
  + *
  + * The Apache Software License, Version 1.1
  + *
  + * Copyright (c) 1999-2003 The Apache Software Foundation.  All rights
  + * reserved.
  + *
  + * Redistribution and use in source and binary forms, with or without
  + * modification, are permitted provided that the following conditions
  + * are met:
  + *
  + * 1. Redistributions of source code must retain the above copyright
  + *    notice, this list of conditions and the following disclaimer.
  + *
  + * 2. Redistributions in binary form must reproduce the above copyright
  + *    notice, this list of conditions and the following disclaimer in
  + *    the documentation and/or other materials provided with the
  + *    distribution.
  + *
  + * 3. The end-user documentation included with the redistribution, if
  + *    any, must include the following acknowlegement:
  + *       "This product includes software developed by the
  + *        Apache Software Foundation (http://www.apache.org/)."
  + *    Alternately, this acknowlegement may appear in the software itself,
  + *    if and wherever such third-party acknowlegements normally appear.
  + *
  + * 4. The names "The Jakarta Project", "Commons", and "Apache Software
  + *    Foundation" must not be used to endorse or promote products derived
  + *    from this software without prior written permission. For written
  + *    permission, please contact apache@apache.org.
  + *
  + * 5. Products derived from this software may not be called "Apache"
  + *    nor may "Apache" appear in their names without prior written
  + *    permission of the Apache Group.
  + *
  + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  + * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
  + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  + * SUCH DAMAGE.
  + * ====================================================================
  + *
  + * This software consists of voluntary contributions made by many
  + * individuals on behalf of the Apache Software Foundation.  For more
  + * information on the Apache Software Foundation, please see
  + * <http://www.apache.org/>;.
  + *
  + */
   package org.apache.commons.cli;
   
   import java.util.Iterator;
  @@ -14,23 +74,121 @@
    */
   public interface CommandLine {
   
  -	List getUnprocessed();
  -	
  -	boolean hasOption( String id );
  -
  -	boolean hasArgument( String id );
  -
  -    List getValues( String id );
  -
  -    String getValue( String id );
  -
  -    String getValue( String id, String def );
  -
  -    Object getValueAsObject( String id );
  -    
  +    /**
  +     * @task investigate whether this can be eliminated
  +     * 
  +     * Returns the list of unprocessed command line arguments
  +     * 
  +     * @return the list of unprocess command line arguments
  +     */
  +    List getUnprocessed();
  +
  +    /**
  +     * Returns whether the specified Option is present on
  +     * the command line.
  +     * 
  +     * @param id
  +     *     the identification of the Option, the search
  +     *     is based on short name, then long name.
  +     * 
  +     * @return true if the Option exists, otherwise false.
  +     */
  +    boolean hasOption(String id);
  +
  +    /**
  +     * Returns whether the specified Argument is present on
  +     * the command line.
  +     * 
  +     * @param id
  +     *     the identification of the Argument, the search
  +     *     is based on short name, then long name.
  +     * 
  +     * @return true if the Argument exists, otherwise false.
  +     */
  +    boolean hasArgument(String id);
  +
  +    /**
  +     * Returns the values for the specified Argument.
  +     * 
  +     * @param id
  +     *     the identification of the Argument, the search
  +     *     is based on short name, then long name.
  +     * 
  +     * @return the List of values if the Argument exists, 
  +     *     otherwise false.
  +     */
  +    List getValues(String id);
  +
  +    /**
  +     * Returns the value for the specified Argument.  If there
  +     * is more than one value available for the specified
  +     * Argument, return the first value.
  +     * 
  +     * @param id
  +     *     the identification of the Argument, the search
  +     *     is based on short name, then long name.
  +     * 
  +     * @return the value if the Argument exists, otherwise false.
  +     */
  +    String getValue(String id);
  +
  +    /**
  +     * Returns the value for the specified Argument as a 
  +     * String.  If there is more than one value available 
  +     * for the specified Argument, return the first value.
  +     * 
  +     * @param id
  +     *     the identification of the Argument, the search
  +     *     is based on short name, then long name.
  +     * 
  +     * @param def
  +     *     the default value for the specified Argument
  +     * 
  +     * @return the value if the Argument exists, otherwise 
  +     *     the default value specified.
  +     */
  +    String getValue(String id, String def);
  +
  +    /**
  +     * Returns the value for the specified Argument as 
  +     * the type specified by the Argument.  
  +     * 
  +     * @param id
  +     *     the identification of the Argument, the search
  +     *     is based on short name, then long name.
  +     * 
  +     * @return the value as the type specified, if the type that
  +     *     was specified is not supported return null
  +     */
  +    Object getValueAsObject(String id);
  +
  +    /**
  +     * Returns an iterator over the Options and Arguments of
  +     * this command line.
  +     * 
  +     * @task should this support the anonymous argument
  +     * 
  +     * @return the iterator which returns the Options and Argument
  +     *     in the order in which they were parsed
  +     */
       Iterator iterator();
  -    
  +
  +    /**
  +     * Returns the Java properties that were found on the command line,
  +     * that is all '-D' arguments.
  +     * 
  +     * @return the Java Properties instance that represents the Java
  +     *     properties that were specified on the command line.
  +     *     If there were none, an empty Properties instance is
  +     *     returned.
  +     */
       Properties getProperties();
  -    
  -	List getAnonymousValues();
  +
  +    /**
  +     * Return the values of the anonymous argument.
  +     * 
  +     * @return the values for the anonymous argument.  If there were
  +     *     no values, return an empty List instance.
  +     */
  +    List getAnonymousValues();
   }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org