ec.util
Interface IParameterDatabase

All Superinterfaces:
java.io.Serializable
All Known Implementing Classes:
CollectionsParameterDatabase, ParameterDatabase

public interface IParameterDatabase
extends java.io.Serializable


Field Summary
static java.lang.String C_HERE
           
static java.lang.String PRINT_PARAMS
           
static int PS_NONE
           
static int PS_PRINT_PARAMS
           
static int PS_UNKNOWN
           
static java.lang.String UNKNOWN_VALUE
           
 
Method Summary
 java.io.File directoryFor(Parameter parameter)
          Searches down through databases to find the directory for the database which holds a given parameter.
 boolean exists(Parameter parameter)
          Returns true if parameter exist in the database
 boolean exists(Parameter parameter, Parameter defaultParameter)
          Returns true if either parameter or defaultParameter exists in the database
 java.io.File fileFor(Parameter parameter)
          Searches down through databases to find the parameter file which holds a given parameter.
 boolean getBoolean(Parameter parameter, Parameter defaultParameter, boolean defaultValue)
          Searches down through databases to find a given parameter; If the parameter does not exist, defaultValue is returned.
 java.lang.Class getClassForParameter(Parameter parameter, Parameter defaultParameter, java.lang.Class mustCastTosuperclass)
          Searches down through databases to find a given parameter.
 double getDouble(Parameter parameter, Parameter defaultParameter, double minValue)
          Searches down through databases to find a given parameter, whose value must be a double >= minValue.
 double getDouble(Parameter parameter, Parameter defaultParameter, double minValue, double maxValue)
          Searches down through databases to find a given parameter, whose value must be a double >= minValue and <= maxValue.
 double getDoubleWithDefault(Parameter parameter, Parameter defaultParameter, double defaultValue)
          Searches down through databases to find a given parameter, which must be a float.
 java.io.File getFile(Parameter parameter, Parameter defaultParameter)
          Searches down through the databases to find a given parameter, whose value must be an absolute or relative path name.
 float getFloat(Parameter parameter, Parameter defaultParameter, double minValue)
          Gets a parameter whose value must be a float >= minValue.
 float getFloat(Parameter parameter, Parameter defaultParameter, double minValue, double maxValue)
          Searches down through databases to find a given parameter, whose value must be a float >= minValue and <= maxValue.
 float getFloatWithDefault(Parameter parameter, Parameter defaultParameter, double defaultValue)
          Searches down through databases to find a given parameter, which must be a float.
 java.io.InputStream getInputStream(Parameter parameter, Parameter defaultParameter)
           
 java.lang.Object getInstanceForParameter(Parameter parameter, Parameter defaultParameter, java.lang.Class mustCastTosuperclass)
          Searches down through databases to find a given parameter, whose value must be a full Class name, and the class must be a descendent of but not equal to mustCastTosuperclass .
 java.lang.Object getInstanceForParameterEq(Parameter parameter, Parameter defaultParameter, java.lang.Class mustCastTosuperclass)
          Searches down through databases to find a given parameter, whose value must be a full Class name, and the class must be a descendent, or equal to, mustCastTosuperclass .
 int getInt(Parameter parameter, Parameter defaultParameter)
          Searches down through databases to find a given parameter, whose value must be an integer.
 int getInt(Parameter parameter, Parameter defaultParameter, int minValue)
          Searches down through databases to find a given parameter, whose value must be an integer >= minValue.
 int getIntWithDefault(Parameter parameter, Parameter defaultParameter, int defaultValue)
          Searches down through databases to find a given parameter, which must be an integer.
 int getIntWithMax(Parameter parameter, Parameter defaultParameter, int minValue, int maxValue)
          Searches down through databases to find a given parameter, whose value must be an integer >= minValue and <= maxValue.
 long getLong(Parameter parameter, Parameter defaultParameter)
          Searches down through databases to find a given parameter, whose value must be a long.
 long getLong(Parameter parameter, Parameter defaultParameter, long minValue)
          Searches down through databases to find a given parameter, whose value must be a long >= minValue.
 long getLong(Parameter parameter, Parameter defaultParameter, long minValue, long maxValue)
          Deprecated.  
 long getLongWithDefault(Parameter parameter, Parameter defaultParameter, long defaultValue)
          Searches down through databases to find a given parameter, which must be a long.
 long getLongWithMax(Parameter parameter, Parameter defaultParameter, long minValue, long maxValue)
          Searches down through databases to find a given parameter, whose value must be a long >= minValue and = < maxValue.
 java.lang.String getString(Parameter parameter, Parameter defaultParameter)
          Searches down through databases to find a given parameter.
 java.lang.String getStringWithDefault(Parameter parameter, Parameter defaultParameter, java.lang.String defaultValue)
          Searches down through databases to find a given parameter.
 void list(java.io.PrintStream p)
          Prints out all the parameters in the database, but not shadowed parameters.
 void list(java.io.PrintStream p, boolean listShadowed)
          Prints out all the parameters in the database.
 void list(java.io.PrintWriter p)
          Prints out all the parameters in the database, but not shadowed parameters.
 void list(java.io.PrintWriter p, boolean listShadowed)
          Prints out all the parameters in the database.
 void listAccessed(java.io.PrintWriter p)
          Prints out all the parameters marked as accessed ("gotten" by some getFoo(...) method), plus their values.
 void listGotten(java.io.PrintWriter p)
          Prints out all the parameters marked as used, plus their values.
 void listNotAccessed(java.io.PrintWriter p)
          Prints out all the parameters NOT marked as used, plus their values.
 void listNotGotten(java.io.PrintWriter p)
          Prints out all the parameters NOT marked as used, plus their values.
 java.util.Set<java.lang.String> parameterNameSet()
           
 void remove(Parameter parameter)
          Removes a parameter from the topmost database.
 void set(Parameter parameter, java.lang.String value)
           
 void setObject(Parameter parameter, java.lang.Object value)
           
 

Field Detail

C_HERE

static final java.lang.String C_HERE
See Also:
Constant Field Values

UNKNOWN_VALUE

static final java.lang.String UNKNOWN_VALUE
See Also:
Constant Field Values

PRINT_PARAMS

static final java.lang.String PRINT_PARAMS
See Also:
Constant Field Values

PS_UNKNOWN

static final int PS_UNKNOWN
See Also:
Constant Field Values

PS_NONE

static final int PS_NONE
See Also:
Constant Field Values

PS_PRINT_PARAMS

static final int PS_PRINT_PARAMS
See Also:
Constant Field Values
Method Detail

getInstanceForParameter

java.lang.Object getInstanceForParameter(Parameter parameter,
                                         Parameter defaultParameter,
                                         java.lang.Class mustCastTosuperclass)
                                         throws ParamClassLoadException
Searches down through databases to find a given parameter, whose value must be a full Class name, and the class must be a descendent of but not equal to mustCastTosuperclass . Loads the class and returns an instance (constructed with the default constructor), or throws a ParamClassLoadException if there is no such Class. If the parameter is not found, the defaultParameter is used. The parameter chosen is marked "used".

Throws:
ParamClassLoadException

getInstanceForParameterEq

java.lang.Object getInstanceForParameterEq(Parameter parameter,
                                           Parameter defaultParameter,
                                           java.lang.Class mustCastTosuperclass)
                                           throws ParamClassLoadException
Searches down through databases to find a given parameter, whose value must be a full Class name, and the class must be a descendent, or equal to, mustCastTosuperclass . Loads the class and returns an instance (constructed with the default constructor), or throws a ParamClassLoadException if there is no such Class. The parameter chosen is marked "used".

Throws:
ParamClassLoadException

getClassForParameter

java.lang.Class getClassForParameter(Parameter parameter,
                                     Parameter defaultParameter,
                                     java.lang.Class mustCastTosuperclass)
                                     throws ParamClassLoadException
Searches down through databases to find a given parameter. The value associated with this parameter must be a full Class name, and the class must be a descendent of but not equal to mustCastTosuperclass . Loads and returns the associated Class, or throws a ParamClassLoadException if there is no such Class. If the parameter is not found, the defaultParameter is used. The parameter chosen is marked "used".

Throws:
ParamClassLoadException

getBoolean

boolean getBoolean(Parameter parameter,
                   Parameter defaultParameter,
                   boolean defaultValue)
Searches down through databases to find a given parameter; If the parameter does not exist, defaultValue is returned. If the parameter exists, and it is set to "false" (case insensitive), false is returned. Else true is returned. The parameter chosen is marked "used" if it exists.


getInt

int getInt(Parameter parameter,
           Parameter defaultParameter)
           throws java.lang.NumberFormatException
Searches down through databases to find a given parameter, whose value must be an integer. It returns the value, else throws a NumberFormatException exception if there is an error in parsing the parameter. The parameter chosen is marked "used" if it exists. Integers may be in decimal or (if preceded with an X or x) in hexadecimal.

Throws:
java.lang.NumberFormatException

getInt

int getInt(Parameter parameter,
           Parameter defaultParameter,
           int minValue)
Searches down through databases to find a given parameter, whose value must be an integer >= minValue. It returns the value, or minValue-1 if the value is out of range or if there is an error in parsing the parameter. The parameter chosen is marked "used" if it exists. Integers may be in decimal or (if preceded with an X or x) in hexadecimal.


getIntWithDefault

int getIntWithDefault(Parameter parameter,
                      Parameter defaultParameter,
                      int defaultValue)
Searches down through databases to find a given parameter, which must be an integer. If there is an error in parsing the parameter, then default is returned. The parameter chosen is marked "used" if it exists. Integers may be in decimal or (if preceded with an X or x) in hexadecimal.


getIntWithMax

int getIntWithMax(Parameter parameter,
                  Parameter defaultParameter,
                  int minValue,
                  int maxValue)
Searches down through databases to find a given parameter, whose value must be an integer >= minValue and <= maxValue. It returns the value, or minValue-1 if the value is out of range or if there is an error in parsing the parameter. The parameter chosen is marked "used" if it exists. Integers may be in decimal or (if preceded with an X or x) in hexadecimal.


getFloat

float getFloat(Parameter parameter,
               Parameter defaultParameter,
               double minValue)
Gets a parameter whose value must be a float >= minValue.

Parameters:
parameter - Primary parameter
defaultParameter - Default parameter
Returns:
Parameter value, or minValue-1 if the parameter doesn't exist or is out of range.

getFloatWithDefault

float getFloatWithDefault(Parameter parameter,
                          Parameter defaultParameter,
                          double defaultValue)
Searches down through databases to find a given parameter, which must be a float. If there is an error in parsing the parameter, then default is returned. The parameter chosen is marked "used" if it exists.


getFloat

float getFloat(Parameter parameter,
               Parameter defaultParameter,
               double minValue,
               double maxValue)
Searches down through databases to find a given parameter, whose value must be a float >= minValue and <= maxValue. If not, this method returns minvalue-1, else it returns the parameter value. The parameter chosen is marked "used" if it exists.


getDouble

double getDouble(Parameter parameter,
                 Parameter defaultParameter,
                 double minValue)
Searches down through databases to find a given parameter, whose value must be a double >= minValue. If not, this method returns minvalue-1, else it returns the parameter value. The parameter chosen is marked "used" if it exists.


getDouble

double getDouble(Parameter parameter,
                 Parameter defaultParameter,
                 double minValue,
                 double maxValue)
Searches down through databases to find a given parameter, whose value must be a double >= minValue and <= maxValue. If not, this method returns minvalue-1, else it returns the parameter value. The parameter chosen is marked "used" if it exists.


getDoubleWithDefault

double getDoubleWithDefault(Parameter parameter,
                            Parameter defaultParameter,
                            double defaultValue)
Searches down through databases to find a given parameter, which must be a float. If there is an error in parsing the parameter, then default is returned. The parameter chosen is marked "used" if it exists.


getLong

long getLong(Parameter parameter,
             Parameter defaultParameter)
             throws java.lang.NumberFormatException
Searches down through databases to find a given parameter, whose value must be a long. It returns the value, else throws a NumberFormatException exception if there is an error in parsing the parameter. The parameter chosen is marked "used" if it exists. Longs may be in decimal or (if preceded with an X or x) in hexadecimal.

Throws:
java.lang.NumberFormatException

getLong

long getLong(Parameter parameter,
             Parameter defaultParameter,
             long minValue)
Searches down through databases to find a given parameter, whose value must be a long >= minValue. If not, this method returns errValue, else it returns the parameter value. The parameter chosen is marked "used" if it exists. Longs may be in decimal or (if preceded with an X or x) in hexadecimal.


getLongWithDefault

long getLongWithDefault(Parameter parameter,
                        Parameter defaultParameter,
                        long defaultValue)
Searches down through databases to find a given parameter, which must be a long. If there is an error in parsing the parameter, then default is returned. The parameter chosen is marked "used" if it exists. Longs may be in decimal or (if preceded with an X or x) in hexadecimal.


getLongWithMax

long getLongWithMax(Parameter parameter,
                    Parameter defaultParameter,
                    long minValue,
                    long maxValue)
Searches down through databases to find a given parameter, whose value must be a long >= minValue and = < maxValue. If not, this method returns errValue, else it returns the parameter value. The parameter chosen is marked "used" if it exists. Longs may be in decimal or (if preceded with an X or x) in hexadecimal.


getLong

long getLong(Parameter parameter,
             Parameter defaultParameter,
             long minValue,
             long maxValue)
Deprecated. 

Use getLongWithMax(...) instead. Searches down through databases to find a given parameter, whose value must be a long >= minValue and = < maxValue. If not, this method returns errValue, else it returns the parameter value. The parameter chosen is marked "used" if it exists. Longs may be in decimal or (if preceded with an X or x) in hexadecimal.


getFile

java.io.File getFile(Parameter parameter,
                     Parameter defaultParameter)
Searches down through the databases to find a given parameter, whose value must be an absolute or relative path name. If it is absolute, a File is made based on the path name. If it is relative, a file is made by resolving the path name with respect to the directory in which the file was which defined this EcjParameterDatabase in the EcjParameterDatabase hierarchy. If the parameter is not found, this returns null. The File is not checked for validity. The parameter chosen is marked "used" if it exists.


getInputStream

java.io.InputStream getInputStream(Parameter parameter,
                                   Parameter defaultParameter)

getString

java.lang.String getString(Parameter parameter,
                           Parameter defaultParameter)
Searches down through databases to find a given parameter. Returns the parameter's value (trimmed) or null if not found or if the trimmed result is empty. The parameter chosen is marked "used" if it exists.


getStringWithDefault

java.lang.String getStringWithDefault(Parameter parameter,
                                      Parameter defaultParameter,
                                      java.lang.String defaultValue)
Searches down through databases to find a given parameter. Returns the parameter's value trimmed of whitespace, or defaultValue.trim() if the result is not found or the trimmed result is empty.


exists

boolean exists(Parameter parameter)
Returns true if parameter exist in the database


exists

boolean exists(Parameter parameter,
               Parameter defaultParameter)
Returns true if either parameter or defaultParameter exists in the database


directoryFor

java.io.File directoryFor(Parameter parameter)
Searches down through databases to find the directory for the database which holds a given parameter. Returns the directory name or null if not found.


fileFor

java.io.File fileFor(Parameter parameter)
Searches down through databases to find the parameter file which holds a given parameter. Returns the filename or null if not found.


set

void set(Parameter parameter,
         java.lang.String value)

setObject

void setObject(Parameter parameter,
               java.lang.Object value)

remove

void remove(Parameter parameter)
Removes a parameter from the topmost database.


parameterNameSet

java.util.Set<java.lang.String> parameterNameSet()

listGotten

void listGotten(java.io.PrintWriter p)
Prints out all the parameters marked as used, plus their values. If a parameter was listed as "used" but not's actually in the database, the value printed is UNKNOWN_VALUE (set to "?????")


listNotGotten

void listNotGotten(java.io.PrintWriter p)
Prints out all the parameters NOT marked as used, plus their values.


listNotAccessed

void listNotAccessed(java.io.PrintWriter p)
Prints out all the parameters NOT marked as used, plus their values.


listAccessed

void listAccessed(java.io.PrintWriter p)
Prints out all the parameters marked as accessed ("gotten" by some getFoo(...) method), plus their values. If this method ever prints UNKNOWN_VALUE ("?????"), that's a bug.


list

void list(java.io.PrintStream p,
          boolean listShadowed)
Prints out all the parameters in the database. Useful for debugging. If listShadowed is true, each parameter is printed with the parameter database it's located in. If listShadowed is false, only active parameters are listed, and they're all given in one big chunk.


list

void list(java.io.PrintStream p)
Prints out all the parameters in the database, but not shadowed parameters.


list

void list(java.io.PrintWriter p)
Prints out all the parameters in the database, but not shadowed parameters.


list

void list(java.io.PrintWriter p,
          boolean listShadowed)
Prints out all the parameters in the database. Useful for debugging. If listShadowed is true, each parameter is printed with the parameter database it's located in. If listShadowed is false, only active parameters are listed, and they're all given in one big chunk.