commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jke...@apache.org
Subject cvs commit: jakarta-commons/cli/src/java/org/apache/commons/cli CommandLineCreator.java CommandLineImpl.java CommandLine.java CommandLineParser.java
Date Sat, 24 May 2003 17:25:04 GMT
jkeyes      2003/05/24 10:25:04

  Modified:    cli/src/java/org/apache/commons/cli Tag: cli_1_x
                        CommandLineImpl.java CommandLine.java
                        CommandLineParser.java
  Added:       cli/src/java/org/apache/commons/cli Tag: cli_1_x
                        CommandLineCreator.java
  Log:
  modified CommandLine to be a readOnly type interface

introduced CommandLineCreator to provide
write interface to CommandLine

modified CommandLineParser to use CommandLineWriter interface
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.2   +1 -1      jakarta-commons/cli/src/java/org/apache/commons/cli/Attic/CommandLineImpl.java
  
  Index: CommandLineImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/cli/src/java/org/apache/commons/cli/Attic/CommandLineImpl.java,v
  retrieving revision 1.1.2.1
  retrieving revision 1.1.2.2
  diff -u -r1.1.2.1 -r1.1.2.2
  --- CommandLineImpl.java	19 May 2003 20:57:51 -0000	1.1.2.1
  +++ CommandLineImpl.java	24 May 2003 17:25:03 -0000	1.1.2.2
  @@ -9,7 +9,7 @@
   
   import org.apache.commons.cli.util.TypeHandler;
   
  -class CommandLineImpl implements CommandLine {
  +class CommandLineImpl implements CommandLine, CommandLineCreator {
   
       Map cache = new HashMap(11);
       Map typeCache = new HashMap(11);
  
  
  
  1.17.2.2  +8 -8      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.1
  retrieving revision 1.17.2.2
  diff -u -r1.17.2.1 -r1.17.2.2
  --- CommandLine.java	19 May 2003 20:59:44 -0000	1.17.2.1
  +++ CommandLine.java	24 May 2003 17:25:03 -0000	1.17.2.2
  @@ -4,18 +4,18 @@
   import java.util.List;
   import java.util.Properties;
   
  +/**
  + * Instances of CommandLine represent a command line that
  + * has been processed according to the definition supplied
  + * to the parser.
  + * 
  + * @author John Keyes
  + * @since 1.0
  + */
   public interface CommandLine {
   
  -    void addOption( Option option );
  -
  -    void addArgument( Argument argument, List values );
  -    
  -    void setProperties( Properties properties );
  -
   	List getUnprocessed();
   	
  -	void setUnprocessed(List values);
  -	    
   	boolean hasOption( String id );
   
   	boolean hasArgument( String id );
  
  
  
  1.6.2.2   +9 -8      jakarta-commons/cli/src/java/org/apache/commons/cli/CommandLineParser.java
  
  Index: CommandLineParser.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/cli/src/java/org/apache/commons/cli/CommandLineParser.java,v
  retrieving revision 1.6.2.1
  retrieving revision 1.6.2.2
  diff -u -r1.6.2.1 -r1.6.2.2
  --- CommandLineParser.java	19 May 2003 20:59:44 -0000	1.6.2.1
  +++ CommandLineParser.java	24 May 2003 17:25:03 -0000	1.6.2.2
  @@ -29,7 +29,7 @@
           this.stopAtUnknown = stopAtUnknown;
       }
   
  -	public CommandLine parse( Options options, String[] args, CommandLine cmdline)
  +	public CommandLine parse( Options options, String[] args, CommandLineCreator cmdline)
   	throws UnknownOptionException, MissingValueException, MissingOptionException, AlreadySelectedException,
ParseException {
   		this.options = options;
   		List tokens = Arrays.asList( args );
  @@ -53,7 +53,7 @@
   				if (option instanceof Argument) {
   					cmdline.addArgument(
   						(Argument) option,
  -						processArgument((Argument) option, iter));
  +				    	processArgument((Argument) option, iter));
   				}
   				else {
   					cmdline.addOption( option );
  @@ -123,7 +123,8 @@
   			}
   		}
   		cmdline.setProperties(this.props);
  -		return cmdline;
  +        
  +		return (CommandLine)cmdline;
   	}
   	
   	Properties props = new Properties();
  @@ -151,12 +152,12 @@
   		
   	public CommandLine parse( Options options, String[] args ) 
   	throws UnknownOptionException, MissingValueException, MissingOptionException, AlreadySelectedException,
ParseException {
  -		CommandLine cmdline = new CommandLineImpl();
  +		CommandLineCreator cmdline = new CommandLineImpl();
   		parse( options, args, cmdline);
  -        return cmdline;
  +        return (CommandLine)cmdline;
       }
       
  -    private void processChildOptions( Option option, String[] arguments, int index, CommandLine
cmdline) 
  +    private void processChildOptions( Option option, String[] arguments, int index, CommandLineCreator
cmdline) 
       throws UnknownOptionException, MissingValueException, MissingOptionException, AlreadySelectedException,
ParseException {
       	
       	if( option.getChildren().size() > 0 ) {
  @@ -259,7 +260,7 @@
           }
       }
   
  -    private void burst(String token, CommandLine cmdline, ListIterator iter) 
  +    private void burst(String token, CommandLineCreator cmdline, ListIterator iter) 
       throws UnknownOptionException, MissingValueException, AlreadySelectedException
       {
           int tokenLength = token.length();
  @@ -294,7 +295,7 @@
               }
           }
       }
  -
  +    
       private void recordIfInOptionGroup( Options options, Option option ) 
       throws AlreadySelectedException
       {
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.1   +116 -0    jakarta-commons/cli/src/java/org/apache/commons/cli/Attic/CommandLineCreator.java
  
  
  
  

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


Mime
View raw message