Java Doc for Option.java in  » Library » Apache-command-line » org » apache » commons » cli » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Library » Apache command line » org.apache.commons.cli 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.apache.commons.cli.Option

Option
public class Option implements Cloneable(Code)

Describes a single command-line option. It maintains information regarding the short-name of the option, the long-name, if any exists, a flag indicating if an argument is required for this option, and a self-documenting description of the option.

An Option is not created independantly, but is create through an instance of Options .


See Also:   org.apache.commons.cli.Options
See Also:   org.apache.commons.cli.CommandLine
author:
   bob mcwhirter (bob @ werken.com)
author:
   James Strachan
version:
   $Revision: 551821 $



Field Summary
final public static  intUNINITIALIZED
    
final public static  intUNLIMITED_VALUES
    

Constructor Summary
public  Option(String opt, String description)
     Creates an Option using the specified parameters.
public  Option(String opt, boolean hasArg, String description)
     Creates an Option using the specified parameters.
public  Option(String opt, String longOpt, boolean hasArg, String description)
     Creates an Option using the specified parameters.

Method Summary
public  booleanaddValue(String value)
     This method is not intended to be used.
 voidaddValueForProcessing(String value)
     Adds the specified value to this Option.
 voidclearValues()
    

Clear the Option values.

public  Objectclone()
     A rather odd clone method - due to incorrect code in 1.0 it is public and in 1.1 rather than throwing a CloneNotSupportedException it throws a RuntimeException so as to maintain backwards compat at the API level.
public  booleanequals(Object o)
    
public  StringgetArgName()
     Gets the display name for the argument value.
public  intgetArgs()
     Returns the number of argument values this Option can take.
public  StringgetDescription()
    
public  intgetId()
     Returns the id of this Option.
 StringgetKey()
     Returns the 'unique' Option identifier.
public  StringgetLongOpt()
     Retrieve the long name of this Option.
public  StringgetOpt()
     Retrieve the name of this Option.
public  ObjectgetType()
     Retrieve the type of this Option.
public  StringgetValue()
     Returns the specified value of this Option or null if there is no value.
public  StringgetValue(int index)
     Returns the specified value of this Option or null if there is no value.
Parameters:
  index - The index of the value to be returned.
public  StringgetValue(String defaultValue)
     Returns the value/first value of this Option or the defaultValue if there is no value.
Parameters:
  defaultValue - The value to be returned if theris no value.
public  chargetValueSeparator()
     Returns the value separator character.
public  String[]getValues()
    
public  java.util.ListgetValuesList()
    
public  booleanhasArg()
    
public  booleanhasArgName()
     Returns whether the display name for the argument value has been set.
public  booleanhasArgs()
     Query to see if this Option can take many values.
public  booleanhasLongOpt()
    
public  booleanhasOptionalArg()
    
public  booleanhasValueSeparator()
     Return whether this Option has specified a value separator.
public  inthashCode()
    
public  booleanisRequired()
    
public  voidsetArgName(String argName)
     Sets the display name for the argument value.
public  voidsetArgs(int num)
     Sets the number of argument values this Option can take.
public  voidsetDescription(String description)
    
public  voidsetLongOpt(String longOpt)
     Sets the long name of this Option.
public  voidsetOptionalArg(boolean optionalArg)
     Sets whether this Option can have an optional argument.
public  voidsetRequired(boolean required)
     Sets whether this Option is mandatory.
public  voidsetType(Object type)
     Sets the type of this Option.
public  voidsetValueSeparator(char sep)
     Sets the value separator.
public  StringtoString()
     Dump state, suitable for debugging.

Field Detail
UNINITIALIZED
final public static int UNINITIALIZED(Code)
constant that specifies the number of argument values has not been specified



UNLIMITED_VALUES
final public static int UNLIMITED_VALUES(Code)
constant that specifies the number of argument values is infinite




Constructor Detail
Option
public Option(String opt, String description) throws IllegalArgumentException(Code)
Creates an Option using the specified parameters.
Parameters:
  opt - short representation of the option
Parameters:
  description - describes the function of the option
throws:
  IllegalArgumentException - if there are any non validOption characters in opt.



Option
public Option(String opt, boolean hasArg, String description) throws IllegalArgumentException(Code)
Creates an Option using the specified parameters.
Parameters:
  opt - short representation of the option
Parameters:
  hasArg - specifies whether the Option takes an argument or not
Parameters:
  description - describes the function of the option
throws:
  IllegalArgumentException - if there are any non validOption characters in opt.



Option
public Option(String opt, String longOpt, boolean hasArg, String description) throws IllegalArgumentException(Code)
Creates an Option using the specified parameters.
Parameters:
  opt - short representation of the option
Parameters:
  longOpt - the long representation of the option
Parameters:
  hasArg - specifies whether the Option takes an argument or not
Parameters:
  description - describes the function of the option
throws:
  IllegalArgumentException - if there are any non validOption characters in opt.




Method Detail
addValue
public boolean addValue(String value)(Code)
This method is not intended to be used. It was a piece of internal API that was made public in 1.0. It currently throws an UnsupportedOperationException.
throws:
  UnsupportedOperationException -



addValueForProcessing
void addValueForProcessing(String value)(Code)
Adds the specified value to this Option.
Parameters:
  value - is a/the value of this Option



clearValues
void clearValues()(Code)

Clear the Option values. After a parse is complete, these are left with data in them and they need clearing if another parse is done.

See: CLI-71



clone
public Object clone()(Code)
A rather odd clone method - due to incorrect code in 1.0 it is public and in 1.1 rather than throwing a CloneNotSupportedException it throws a RuntimeException so as to maintain backwards compat at the API level. After calling this method, it is very likely you will want to call clearValues().
throws:
  RuntimeException -



equals
public boolean equals(Object o)(Code)



getArgName
public String getArgName()(Code)
Gets the display name for the argument value. the display name for the argument value.



getArgs
public int getArgs()(Code)
Returns the number of argument values this Option can take. num the number of argument values



getDescription
public String getDescription()(Code)
Retrieve the self-documenting description of this Option The string description of this option



getId
public int getId()(Code)
Returns the id of this Option. This is only set when the Option shortOpt is a single character. This is used for switch statements. the id of this Option



getKey
String getKey()(Code)
Returns the 'unique' Option identifier. the 'unique' Option identifier



getLongOpt
public String getLongOpt()(Code)
Retrieve the long name of this Option. Long name of this option, or null, if there is no long name



getOpt
public String getOpt()(Code)
Retrieve the name of this Option. It is this String which can be used with CommandLine.hasOption(String opt) and CommandLine.getOptionValue(String opt) to check for existence and argument. The name of this option



getType
public Object getType()(Code)
Retrieve the type of this Option. The type of this option



getValue
public String getValue()(Code)
Returns the specified value of this Option or null if there is no value. the value/first value of this Option or null if there is no value.



getValue
public String getValue(int index) throws IndexOutOfBoundsException(Code)
Returns the specified value of this Option or null if there is no value.
Parameters:
  index - The index of the value to be returned. the specified value of this Option or null if there is no value.
throws:
  IndexOutOfBoundsException - if index is less than 1or greater than the number of the values for this Option.



getValue
public String getValue(String defaultValue)(Code)
Returns the value/first value of this Option or the defaultValue if there is no value.
Parameters:
  defaultValue - The value to be returned if theris no value. the value/first value of this Option or the defaultValue if there are no values.



getValueSeparator
public char getValueSeparator()(Code)
Returns the value separator character. the value separator character.



getValues
public String[] getValues()(Code)
Return the values of this Option as a String array or null if there are no values the values of this Option as a String array or null if there are no values



getValuesList
public java.util.List getValuesList()(Code)
the values of this Option as a Listor null if there are no values



hasArg
public boolean hasArg()(Code)
Query to see if this Option requires an argument boolean flag indicating if an argument is required



hasArgName
public boolean hasArgName()(Code)
Returns whether the display name for the argument value has been set. if the display name for the argument value has beenset.



hasArgs
public boolean hasArgs()(Code)
Query to see if this Option can take many values. boolean flag indicating if multiple values are allowed



hasLongOpt
public boolean hasLongOpt()(Code)
Query to see if this Option has a long name boolean flag indicating existence of a long name



hasOptionalArg
public boolean hasOptionalArg()(Code)
whether this Option can have an optional argument



hasValueSeparator
public boolean hasValueSeparator()(Code)
Return whether this Option has specified a value separator. whether this Option has specified a value separator.



hashCode
public int hashCode()(Code)



isRequired
public boolean isRequired()(Code)
Query to see if this Option requires an argument boolean flag indicating if an argument is required



setArgName
public void setArgName(String argName)(Code)
Sets the display name for the argument value.
Parameters:
  argName - the display name for the argument value.



setArgs
public void setArgs(int num)(Code)
Sets the number of argument values this Option can take.
Parameters:
  num - the number of argument values



setDescription
public void setDescription(String description)(Code)
Sets the self-documenting description of this Option
Parameters:
  description - The description of this option



setLongOpt
public void setLongOpt(String longOpt)(Code)
Sets the long name of this Option.
Parameters:
  longOpt - the long name of this Option



setOptionalArg
public void setOptionalArg(boolean optionalArg)(Code)
Sets whether this Option can have an optional argument.
Parameters:
  optionalArg - specifies whether the Option can havean optional argument.



setRequired
public void setRequired(boolean required)(Code)
Sets whether this Option is mandatory.
Parameters:
  required - specifies whether this Option is mandatory



setType
public void setType(Object type)(Code)
Sets the type of this Option.
Parameters:
  type - the type of this Option



setValueSeparator
public void setValueSeparator(char sep)(Code)
Sets the value separator. For example if the argument value was a Java property, the value separator would be '='.
Parameters:
  sep - The value separator.



toString
public String toString()(Code)
Dump state, suitable for debugging. Stringified form of this object



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.