com.topologi.diffx.util
Class CommandLine

java.lang.Object
  extended by com.topologi.diffx.util.CommandLine

public final class CommandLine
extends Object

A set of utility methods to help with command-line interface.

The methods in this class would typically be used in the main(String[]) method of a class.

Version:
17 May 2005
Author:
Christophe Lauret

Method Summary
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.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getParameter

public static String getParameter(String name,
                                  String[] args)
Returns the value corresponding to the given switch.

Returns null if any of the parameters is null.

Parameters:
name - The name of the command line switch
args - The command line arguments
Returns:
The value of the parameter or null.

hasSwitch

public static boolean hasSwitch(String name,
                                String[] args)
Return 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.

Parameters:
name - The name of the command line switch.
args - The command line arguments.
Returns:
true if the switch if available; false otherwise.