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 00:35:59 UTC
cvs commit: jakarta-commons/cli/src/java/org/apache/commons/cli Option.java
jkeyes 2003/05/23 15:35:59
Modified: cli/src/java/org/apache/commons/cli Tag: cli_1_x Option.java
Log:
. added Javadoc
Revision Changes Path
No revision
No revision
1.20.2.2 +134 -0 jakarta-commons/cli/src/java/org/apache/commons/cli/Option.java
Index: Option.java
===================================================================
RCS file: /home/cvs/jakarta-commons/cli/src/java/org/apache/commons/cli/Option.java,v
retrieving revision 1.20.2.1
retrieving revision 1.20.2.2
diff -u -r1.20.2.1 -r1.20.2.2
--- Option.java 19 May 2003 20:59:44 -0000 1.20.2.1
+++ Option.java 23 May 2003 22:35:58 -0000 1.20.2.2
@@ -1,14 +1,148 @@
+/*
+ * $Header$
+ * $Revision$
+ * $Date$
+ *
+ * ====================================================================
+ *
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999-2001 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.Set;
+/**
+ * An Option is a command line flag. It specifies some type of
+ * configuration to an application by it presence or lack of it.
+ *
+ * @author John Keyes
+ * @since 2.0
+ */
public interface Option {
+
+ /**
+ * Returns the name of the Option
+ *
+ * @return
+ * the Option name
+ */
String getName();
+
+ /**
+ * Returns the long name of the Option
+ *
+ * @return
+ * the Option long name
+ */
String getLongName();
+
+ /**
+ * Returns the description of the Option
+ *
+ * @return
+ * the textual description of the Option
+ */
String getDescription();
+
+ /**
+ * Adds the specified Option as a child. For example,
+ * if there is an Option '-time' and it has three
+ * children, one for each time period, '-hours', '-mins'
+ * and '-secs'. One way of constructing such a definition
+ * for this would be to create an Option for each time
+ * period and add each of these Options as a child of
+ * '-time'.
+ *
+ * @param childOption
+ * a child Option
+ */
void addChild(Option childOption);
+
+ /**
+ * Adds the specified Set of Options as children.
+ *
+ * @param children
+ * child Options
+ *
+ * @see org.apache.commons.cli.Option.addChild(org.apache.commons.cli.Option)
+ */
void addChildren(Set children);
+
+ /**
+ * Returns whether this Option has any child Options
+ *
+ * @return
+ * true if this Option has children, otherwise false
+ */
boolean hasChildren();
+
+ /**
+ * Returns whether this Option must be present in the command
+ * line arguments.
+ *
+ * @return
+ * true if the Option must be present in the arguments,
+ * otherwise false
+ */
boolean isRequired();
+
+ /**
+ * Returns the children of the Option
+ *
+ * @return
+ * the Set of children, if there are no children
+ * return null
+ */
Set getChildren();
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org