|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object peersim.config.ConfigContainer
public class ConfigContainer
This class is the container for the configuration data used in
Configuration
; see that class for more information.
Constructor Summary | |
---|---|
ConfigContainer(java.util.Properties config,
boolean check)
|
Method Summary | |
---|---|
boolean |
contains(java.lang.String name)
|
boolean |
getBoolean(java.lang.String name)
Reads given property. |
boolean |
getBoolean(java.lang.String name,
boolean def)
Reads given configuration property. |
java.lang.Class |
getClass(java.lang.String name)
Reads given configuration property. |
java.lang.Class |
getClass(java.lang.String name,
java.lang.Class def)
Reads given configuration property. |
double |
getDouble(java.lang.String name)
Reads given configuration property. |
double |
getDouble(java.lang.String name,
double def)
Reads given configuration property. |
java.lang.Object |
getInstance(java.lang.String name)
Reads given configuration property for a class name. |
java.lang.Object |
getInstance(java.lang.String name,
java.lang.Object def)
Reads given configuration property for a class name. |
java.lang.Object[] |
getInstanceArray(java.lang.String name)
It returns an array of class instances. |
int |
getInt(java.lang.String name)
Reads given configuration property. |
int |
getInt(java.lang.String name,
int def)
Reads given configuration property. |
long |
getLong(java.lang.String name)
Reads given configuration property. |
long |
getLong(java.lang.String name,
long def)
Reads given configuration property. |
java.lang.String[] |
getNames(java.lang.String name)
Returns an array of names prefixed by the specified name. |
int |
getPid(java.lang.String name)
Reads the given property from the configuration interpreting it as a protocol name. |
int |
getPid(java.lang.String name,
int pid)
Calls getPid(String) , and returns the default if no property
is defined with the given name. |
java.lang.String |
getString(java.lang.String name)
Reads given configuration property. |
java.lang.String |
getString(java.lang.String name,
java.lang.String def)
Reads given configuration property. |
java.lang.String |
lookupPid(int pid)
Returns the name of a protocol that has the given identifier. |
int |
lookupPid(java.lang.String protname)
Returns the numeric protocol identifier of the given protocol name. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ConfigContainer(java.util.Properties config, boolean check)
Method Detail |
---|
public boolean contains(java.lang.String name)
public boolean getBoolean(java.lang.String name, boolean def)
MissingParameterException
.
name
- Name of configuration propertydef
- default valuepublic boolean getBoolean(java.lang.String name)
MissingParameterException
. Empty string is not
accepted as false due to the similar function of contains(java.lang.String)
which
returns true in that case. True is returned if the lowercase value of
the property is "true", otherwise false is returned.
name
- Name of configuration propertypublic int getInt(java.lang.String name, int def)
name
- Name of configuration propertydef
- default valuepublic int getInt(java.lang.String name)
MissingParameterException
.
name
- Name of configuration propertypublic long getLong(java.lang.String name, long def)
name
- Name of configuration propertydef
- default valuepublic long getLong(java.lang.String name)
MissingParameterException
.
name
- Name of configuration propertypublic double getDouble(java.lang.String name, double def)
name
- Name of configuration propertydef
- default valuepublic double getDouble(java.lang.String name)
name
- Name of configuration propertypublic java.lang.String getString(java.lang.String name, java.lang.String def)
name
- Name of configuration propertydef
- default valuepublic java.lang.String getString(java.lang.String name)
name
- Name of configuration propertypublic int getPid(java.lang.String name)
Configuration
for
details on how this numeric id is calculated
name
- Name of configuration property
public int getPid(java.lang.String name, int pid)
getPid(String)
, and returns the default if no property
is defined with the given name.
name
- Name of configuration propertypid
- the default protocol identifier
public int lookupPid(java.lang.String protname)
protname
- the protocol name.
public java.lang.String lookupPid(int pid)
Note that this is not a constant time operation in the number of protocols, although typically there are very few protocols defined.
pid
- numeric protocol identifier.
public java.lang.Class getClass(java.lang.String name)
MissingParameterException
. When creating the Class object, a
few attempts are done to resolve the classname. See
Configuration
for details.
name
- Name of configuration propertypublic java.lang.Class getClass(java.lang.String name, java.lang.Class def)
name
- Name of configuration propertydef
- default valuegetClass(String)
public java.lang.Object getInstance(java.lang.String name)
name
- Name of configuration property
MissingParameterException
- if the given property is not defined
IllegalParameterException
- if there is any problem creating the instancepublic java.lang.Object getInstance(java.lang.String name, java.lang.Object def)
name
- Name of configuration propertydef
- The default object that is returned if there is no property
defined with the given name
IllegalParameterException
- if the given name is defined but there is a problem creating
the instance.public java.lang.Object[] getInstanceArray(java.lang.String name)
getInstance(String)
on the names returned by
getNames(String)
.
name
- The component type (i.e. prefix of the list of configuration
properties) which will be passed to getNames(String)
.public java.lang.String[] getNames(java.lang.String name)
"include"+"."+name
or
"order"+"."+name
then the order is
alphabetical. Otherwise this entry defines the order. For more
information see Configuration
.
name
- the component type (i.e., the prefix)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |