Java Doc for CommandLine.java in  » RSS-RDF » Jena-2.5.5 » jena » cmdline » 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 » RSS RDF » Jena 2.5.5 » jena.cmdline 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   jena.cmdline.CommandLine

CommandLine
public class CommandLine (Code)
Command line argument processing based on a trigger model. An action is called whenever an argument is encountered. Example: public static void main (String[] args) { CommandLine cl = new CommandLine() ; cl.add(false, "verbose") .add(true, "--file") ; cl.process(args) ; for ( Iterator iter = cl.args() ; iter.hasNext() ; ) ... } A gloabl hook is provided to inspect arguments just before the action. Tracing is enabled by setting this to a suitable function such as that provided by trace(): cl.setHook(cl.trace()) ;
  • Neutral as to whether options have - or --
  • Does not allow multiple single letter options to be concatenated.
  • Options may be ended with - or --
  • Arguments with values can use "="

author:
   Andy Seaborne
version:
   $Id: CommandLine.java,v 1.14 2008/01/02 12:09:55 andy_seaborne Exp $


Field Summary
protected  booleanallowItemIndirect
    
protected  ArgHandlerargHook
    
protected  MapargMap
    
protected  Mapargs
    
 booleanignoreIndirectionMarker
    
 StringindirectionMarker
    
protected  Listitems
    
protected  Stringusage
    

Constructor Summary
public  CommandLine()
    

Method Summary
public  CommandLineadd(String argName, boolean hasValue)
     Add an argument to those to be accepted on the command line.
public  CommandLineadd(boolean hasValue, String argName)
     Add an argument to those to be accepted on the command line.
public  CommandLineadd(ArgDecl arg)
    
public  booleanallowItemIndirect()
    
public  Iteratorargs()
    
public  booleancontains(ArgDecl argDecl)
     Test whether an argument was seen.
public  booleancontains(String s)
     Test whether an argument was seen.
public  booleanendProcessing(String argStr)
     Answer true if this argument terminates argument processing for the rest of the command line.
public  ArggetArg(ArgDecl argDecl)
     Get the argument associated with the argument declaration.
public  ArggetArg(String s)
     Get the argument associated with the arguement name.
public  StringgetIndirectionMarker()
    
public  StringgetItem(int i)
    
public  StringgetItem(int i, boolean withIndirect)
    
public  StringgetValue(ArgDecl argDecl)
     Returns the value (a string) for an argument with a value - returns null for no argument and no value.
public  StringgetValue(String argName)
     Returns the value (a string) for an argument with a value - returns null for no argument and no value.
public  ListgetValues(ArgDecl argDecl)
     Returns all the values (0 or more strings) for an argument.
public  ListgetValues(String argName)
     Returns all the values (0 or more strings) for an argument.
public  voidhandleUnrecognizedArg(String argStr)
    
public  booleanhasArg(String argName)
    
public  booleanhasArg(ArgDecl argDecl)
    
public  booleanhasArgs()
    
public  booleanhasItems()
    
public  booleanignoreArgument(String argStr)
    
public  booleanisIgnoreIndirectionMarker()
    
public  booleanisIndirectItem(int i)
    
public  intnumArgs()
    
public  intnumItems()
    
public  voidprocess(String[] argv)
     Process a set of command line arguments.
public  voidpushItem(String s)
    
public  voidsetAllowItemIndirect(boolean allowItemIndirect)
    
public  voidsetHook(ArgHandler argHandler)
     Set the global argument handler.
public  voidsetIgnoreIndirectionMarker(boolean ignoreIndirectionMarker)
    
public  voidsetIndirectionMarker(String indirectionMarker)
    
public  voidsetUsage(String usageMessage)
    
public  ArgHandlertrace()
    

Field Detail
allowItemIndirect
protected boolean allowItemIndirect(Code)



argHook
protected ArgHandler argHook(Code)



argMap
protected Map argMap(Code)



args
protected Map args(Code)



ignoreIndirectionMarker
boolean ignoreIndirectionMarker(Code)



indirectionMarker
String indirectionMarker(Code)



items
protected List items(Code)



usage
protected String usage(Code)




Constructor Detail
CommandLine
public CommandLine()(Code)
Creates new CommandLine




Method Detail
add
public CommandLine add(String argName, boolean hasValue)(Code)
Add an argument to those to be accepted on the command line.
Parameters:
  argName - Name
Parameters:
  hasValue - True if the command takes a (string) value The CommandLine processor object



add
public CommandLine add(boolean hasValue, String argName)(Code)
Add an argument to those to be accepted on the command line. Argument order reflects ArgDecl.
Parameters:
  hasValue - True if the command takes a (string) value
Parameters:
  argName - Name The CommandLine processor object



add
public CommandLine add(ArgDecl arg)(Code)
Add an argument object
Parameters:
  arg - Argument to add The CommandLine processor object



allowItemIndirect
public boolean allowItemIndirect()(Code)
Returns whether items starting "@" have the value of named file.



args
public Iterator args()(Code)



contains
public boolean contains(ArgDecl argDecl)(Code)
Test whether an argument was seen.



contains
public boolean contains(String s)(Code)
Test whether an argument was seen.



endProcessing
public boolean endProcessing(String argStr)(Code)
Answer true if this argument terminates argument processing for the rest of the command line. Default is to stop just before the first arg that does not start with "-", or is "-" or "--".



getArg
public Arg getArg(ArgDecl argDecl)(Code)
Get the argument associated with the argument declaration. Actually returns the LAST one seen
Parameters:
  argDecl - Argument declaration to find Last argument that matched.



getArg
public Arg getArg(String s)(Code)
Get the argument associated with the arguement name. Actually returns the LAST one seen
Parameters:
  argDecl - Argument declaration to find Last argument that matched.



getIndirectionMarker
public String getIndirectionMarker()(Code)
Returns the indirectionMarker.



getItem
public String getItem(int i)(Code)



getItem
public String getItem(int i, boolean withIndirect)(Code)



getValue
public String getValue(ArgDecl argDecl)(Code)
Returns the value (a string) for an argument with a value - returns null for no argument and no value.
Parameters:
  argDecl - String



getValue
public String getValue(String argName)(Code)
Returns the value (a string) for an argument with a value - returns null for no argument and no value.
Parameters:
  argDecl - String



getValues
public List getValues(ArgDecl argDecl)(Code)
Returns all the values (0 or more strings) for an argument.
Parameters:
  argDecl - List



getValues
public List getValues(String argName)(Code)
Returns all the values (0 or more strings) for an argument.
Parameters:
  argDecl - List



handleUnrecognizedArg
public void handleUnrecognizedArg(String argStr)(Code)
Handle an unrecognised argument; default is to throw an exception
Parameters:
  argStr - The string image of the unrecognised argument



hasArg
public boolean hasArg(String argName)(Code)
Test whether the command line had a particular argument
Parameters:
  argName -



hasArg
public boolean hasArg(ArgDecl argDecl)(Code)
Test whether the command line had a particular argument
Parameters:
  argDecl -



hasArgs
public boolean hasArgs()(Code)



hasItems
public boolean hasItems()(Code)



ignoreArgument
public boolean ignoreArgument(String argStr)(Code)
Hook to test whether this argument should be processed further



isIgnoreIndirectionMarker
public boolean isIgnoreIndirectionMarker()(Code)
Returns the ignoreIndirectionMarker.



isIndirectItem
public boolean isIndirectItem(int i)(Code)



numArgs
public int numArgs()(Code)



numItems
public int numItems()(Code)



process
public void process(String[] argv) throws java.lang.IllegalArgumentException(Code)
Process a set of command line arguments.
Parameters:
  argv - The words of the command line.
throws:
  IllegalArgumentException - Throw when something is wrong (no value found, action fails).



pushItem
public void pushItem(String s)(Code)



setAllowItemIndirect
public void setAllowItemIndirect(boolean allowItemIndirect)(Code)

Parameters:
  allowItemIndirect - Set whether items starting "@" have the value of named file.



setHook
public void setHook(ArgHandler argHandler)(Code)
Set the global argument handler. Called on every valid argument.
Parameters:
  argHandler - Handler



setIgnoreIndirectionMarker
public void setIgnoreIndirectionMarker(boolean ignoreIndirectionMarker)(Code)

Parameters:
  ignoreIndirectionMarker - The ignoreIndirectionMarker to set.



setIndirectionMarker
public void setIndirectionMarker(String indirectionMarker)(Code)

Parameters:
  indirectionMarker - The indirectionMarker to set.



setUsage
public void setUsage(String usageMessage)(Code)



trace
public ArgHandler trace()(Code)



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.