ix.util
Class Parameters

java.lang.Object
  extended by ix.util.Parameters

public abstract class Parameters
extends java.lang.Object

The Parameters class contains methods that allow information from application command-line arguments and from Applet parameters to be used in a uniform way. The class cannot be instantiated.

See Also:
ParameterException

Nested Class Summary
(package private) static class Parameters.AccessRecordingProperties
           
 
Constructor Summary
Parameters()
           
 
Method Summary
static boolean allParametersWereUsed()
           
static void checkParameterUse()
           
static boolean getBoolean(java.lang.String pname)
           
static boolean getBoolean(java.lang.String pname, boolean defaultValue)
           
static java.lang.Class getClass(java.lang.String pname)
           
static java.lang.Class getClass(java.lang.String pname, java.lang.Class defaultValue)
           
static java.awt.Dimension getDimension(java.lang.String pname)
           
static int getInt(java.lang.String pname)
           
static int getInt(java.lang.String pname, int defaultValue)
           
static int getInt(java.lang.String pname, int radix, int defaultValue)
           
static java.util.List getList(java.lang.String pname)
           
static java.util.List getList(java.lang.String pname, java.util.List defaultValue)
           
static java.lang.String getParameter(java.lang.String pname)
          Returns the value of the parameter if one was specified, else returns null.
static java.lang.String getParameter(java.lang.String pname, java.lang.String defaultValue)
           
static java.util.Properties getParameters()
           
static boolean haveParameter(java.lang.String pname)
           
static boolean isApplet()
           
static boolean isInteractive()
           
static void loadParameters(java.lang.String resourceName)
           
static void processCommandLineArguments(java.lang.String[] argv)
          Parse a String[] of command-line arguments.
static java.lang.String requireParameter(java.lang.String pname)
           
static void setApplet(java.applet.Applet a)
           
static void setIsInteractive(boolean v)
           
static void setParameter(java.lang.String pname, java.lang.String value)
          Sets a parameter value.
static boolean usedParameter(java.lang.String pname)
          Returns true if the haveParameter method or any of the parameter "get" methods has been called on the indicated parameter name; else returns false.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Parameters

public Parameters()
Method Detail

setParameter

public static void setParameter(java.lang.String pname,
                                java.lang.String value)
Sets a parameter value. After recording the value, it calls Debug.processParameter(String, String), in case the paraemter affects debugging output. The setParameter method doesn't produce any debugging output of its own until after that call.


getParameters

public static java.util.Properties getParameters()

isInteractive

public static boolean isInteractive()

setIsInteractive

public static void setIsInteractive(boolean v)

getParameter

public static java.lang.String getParameter(java.lang.String pname)
Returns the value of the parameter if one was specified, else returns null.


getParameter

public static java.lang.String getParameter(java.lang.String pname,
                                            java.lang.String defaultValue)

haveParameter

public static boolean haveParameter(java.lang.String pname)

requireParameter

public static java.lang.String requireParameter(java.lang.String pname)

usedParameter

public static boolean usedParameter(java.lang.String pname)
Returns true if the haveParameter method or any of the parameter "get" methods has been called on the indicated parameter name; else returns false.


getInt

public static int getInt(java.lang.String pname)

getInt

public static int getInt(java.lang.String pname,
                         int defaultValue)

getInt

public static int getInt(java.lang.String pname,
                         int radix,
                         int defaultValue)

getBoolean

public static boolean getBoolean(java.lang.String pname)

getBoolean

public static boolean getBoolean(java.lang.String pname,
                                 boolean defaultValue)

getDimension

public static java.awt.Dimension getDimension(java.lang.String pname)

getList

public static java.util.List getList(java.lang.String pname)

getList

public static java.util.List getList(java.lang.String pname,
                                     java.util.List defaultValue)

getClass

public static java.lang.Class getClass(java.lang.String pname)

getClass

public static java.lang.Class getClass(java.lang.String pname,
                                       java.lang.Class defaultValue)

checkParameterUse

public static void checkParameterUse()

allParametersWereUsed

public static boolean allParametersWereUsed()

processCommandLineArguments

public static void processCommandLineArguments(java.lang.String[] argv)
Parse a String[] of command-line arguments. The syntax of an argument is -name=value. The value assigned to a name can the be obtained as a String by calling getParameter("name"). Other get-methods can return values of other types.

If no value is given, the value is the empty string "". For getBoolean(name), this is equivalent to "true".

The syntax -not name, or -no name, is equivalent to -name=false.

The syntax -load resource-name can be used to read parameter values from a file, from a URL, or from a resource looked up by a class- loader. The contents should be lines in name=value syntax.


loadParameters

public static void loadParameters(java.lang.String resourceName)

isApplet

public static boolean isApplet()

setApplet

public static void setApplet(java.applet.Applet a)