fang
Class InitializeApplication

java.lang.Object
  extended by fang.InitializeApplication

public class InitializeApplication
extends Object

Author:
blad

Constructor Summary
InitializeApplication()
           
 
Method Summary
protected static HashMap<String,ArrayList<String>> createParameterTable(String[] args)
          Creates a hash table containing the parameters specified in the argument list.
static void fangMain(String[] args)
          Every application must either contain a "Main-Class" entry in its manifest file or include a main method that looks like this, where MyClass is the name of the program class:
protected static String getCommandLine()
          Returns the command line that invoked this program, or null if no command line is available.
protected static String readMainClassFromCommandLine(String line)
          Attempts to read the name of the main class from the specified command line.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InitializeApplication

public InitializeApplication()
Method Detail

createParameterTable

protected static HashMap<String,ArrayList<String>> createParameterTable(String[] args)
Creates a hash table containing the parameters specified in the argument list. Parameters are taken to be any argument that matches the template

   name=value All other arguments are collected and placed in an entry under the key "ARGS". All named parameters are converted to lower case to preserve the case-insensitive semantics of getParameter.

Parameters:
args - The array of strings passed to the application
Returns:
A HashMap containing the parameter bindings

readMainClassFromCommandLine

protected static String readMainClassFromCommandLine(String line)
Attempts to read the name of the main class from the specified command line. This strategy is a heuristic and will probably fail in many cases, but it will probably work in enough contexts to be useful. As noted in the documentation for the main method, programs can always avoid the need for this method by supplying their own version of main.

Parameters:
line - The command line
Returns:
The name of the main class, or null

fangMain

public static void fangMain(String[] args)
Every application must either contain a "Main-Class" entry in its manifest file or include a main method that looks like this, where MyClass is the name of the program class:

   public static void main(String[] args)
   {
      new MyClass().start();
   }

If the program needs the command line arguments, the args array can be passed to the start method and then retrieved using the getArgumentArray method.

Parameters:
args - An array of string arguments

getCommandLine

protected static String getCommandLine()
Returns the command line that invoked this program, or null if no command line is available.

Returns:
The command line that invoked this program