Author: bayard Date: Sun Nov 18 13:41:21 2007 New Revision: 596140 URL: http://svn.apache.org/viewvc?rev=596140&view=rev Log: Added patch to CLI-141 that makes Option Serializable - Thanks to Henning and Bjorn
Modified: commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/Option.java Modified: commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/Option.java URL: http://svn.apache.org/viewvc/commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/Option.java?rev=596140&r1=596139&r2=596140&view=diff ============================================================================== --- commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/Option.java (original) +++ commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/Option.java Sun Nov 18 13:41:21 2007 @@ -16,6 +16,7 @@ */ package org.apache.commons.cli; +import java.io.Serializable; import java.util.ArrayList; /** <p>Describes a single command-line option. It maintains @@ -33,7 +34,9 @@ * @author <a href="mailto:[EMAIL PROTECTED]">James Strachan</a> * @version $Revision$ */ -public class Option implements Cloneable { +public class Option implements Cloneable, Serializable { + + private static final long serialVersionUID = 1L; /** constant that specifies the number of argument values has not been specified */ @@ -48,9 +51,6 @@ /** longOpt is the long representation of the option */ private String longOpt; - /** hasArg specifies whether this option has an associated argument */ - private boolean hasArg; - /** argName specifies the name of the argument for this option */ private String argName = "arg"; @@ -136,7 +136,6 @@ this.numberOfArgs = 1; } - this.hasArg = hasArg; this.description = description; } @@ -571,9 +570,11 @@ buf.append(" "); - if (hasArg) + if (hasArgs()) { - buf.append("+ARG"); + buf.append("[ARG...]"); + } else if (hasArg()) { + buf.append(" [ARG]"); } buf.append(" :: ").append(this.description);