net.m2technologies.open_arm.utilities
Class CommandLineParser
java.lang.Object
net.m2technologies.open_arm.utilities.CommandLineParser
- public class CommandLineParser
- extends java.lang.Object
Copyright 2005 Mark Masterson
Licensed under the Apache License, Version 2.0 (the "License");
you may
not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS
OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Description: This class parses a String array, passed as command line parameters to an executable class, via the
#main method. The class will always parse the array passed to the constructor into a) a String, which can be
obtained via the method #getOriginalCommandLine, and b) a Collection, where each delimited element of the original
array becomes an element of the Collection. The default delimiter, if none is specified, is a blank. The resulting
Collection can be obtained via the method #getArgumentList
If these simple represenations are not sufficient, you
can pass an object to the constructors that implements the CommandLineParserStrategy interface. This object will be
used to further parse the the Collection of delimited elements, placing the results into an Object of whatever
complexity is desired or needed. This parsed result object can then be obtained via the method #getParsedResult
- Version:
- 0.009
- Author:
- Mark Masterson
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
CommandLineParser
public CommandLineParser(java.lang.String[] originalCommandLineArguments,
CommandLineParser.CommandLineParserStrategy strategy)
CommandLineParser
public CommandLineParser(java.lang.String[] originalCommandLineArguments,
java.lang.String commandLineDelimiter,
CommandLineParser.CommandLineParserStrategy strategy)
getArgumentList
public java.util.Collection getArgumentList()
getOriginalCommandLine
public java.lang.String getOriginalCommandLine()
getDelimiter
public java.lang.String getDelimiter()
getOriginalArguments
public java.lang.String[] getOriginalArguments()
getParsedResult
public java.lang.Object getParsedResult()