Class CommandLine

java.lang.Object
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
  • Constructor Details

    • CommandLine

      private CommandLine()
      Prevents creation of instances.
  • Method Details

    • 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.