public final class CommandLine extends Object
The methods in this class would typically be used in the main(String[])
method of a class.
Modifier and Type | Method and Description |
---|---|
static String |
getParameter(String name,
String[] args)
Returns the value corresponding to the given switch.
|
static boolean |
hasSwitch(String name,
String[] args)
Return
true if the specified switch exists in the arguments. |
public static String getParameter(String name, String[] args)
Returns null
if any of the parameters is null
.
name
- The name of the command line switchargs
- The command line argumentsnull
.public static boolean hasSwitch(String name, String[] args)
true
if the specified switch exists in the arguments.
This method will go through every argument to check whether the switch exists or not.
Returns false
if any of the parameters is null
.
name
- The name of the command line switch.args
- The command line arguments.true
if the switch if available; false
otherwise.Copyright © 2007-2019. All Rights Reserved.