|
.NET Framework | |||||||||
PREV TYPE NEXT TYPE | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONST | PROP | METHOD | OP | EVENT | DETAIL: FIELD | CONST | PROP | METHOD | OP | EVENT |
Field Summary | |
---|---|
string |
basePath
Base path of the configuration file used to create this ExtendedProperties object. |
string |
file
The file connected to this repository (holding comments and such). * @serial |
string |
fileSeparator
File separator. |
string |
include
This is the name of the property that can point to other properties file for including other properties files. |
bool |
isInitialized
Has this configuration been intialized. |
System.Collections.ArrayList |
keysAsListed
These are the keys in the order they listed in the configuration file. This is useful when you wish to perform operations with configuration information in a particular order. |
Constructor Summary | |
---|---|
ExtendedProperties() Creates an empty extended properties object. |
|
ExtendedProperties(string file) Creates and loads the extended properties from the specified file. * |
|
ExtendedProperties(string file, string defaultFile) Creates and loads the extended properties from the specified file. * |
Property Summary | |
---|---|
string | Include |
System.Collections.IEnumerator | Keys |
Properties inherited from class System.Collections.Hashtable |
---|
comparer, Count, hcp, IsFixedSize, IsReadOnly, IsSynchronized, Item, SyncRoot, Values |
Method Summary | |
---|---|
void |
AddProperty(string key, object token) Add a property to the configuration. If it already exists then the value stated here will be added to the configuration entry. For example, if * resource.loader = file * is already present in the configuration and you * addProperty("resource.loader", "classpath") * Then you will end up with a Vector like the following: * ["file", "classpath"] * |
void |
ClearProperty(string key) Clear a property in the configuration. * |
void |
Combine(Commons.Collections.ExtendedProperties c) Combines an existing Hashtable with this Hashtable. * Warning: It will overwrite previous entries without warning. * |
Commons.Collections.ExtendedProperties |
ConvertProperties(Commons.Collections.ExtendedProperties p) Convert a standard properties class into a configuration class. * |
bool |
GetBoolean(string key, bool defaultValue) Get a boolean associated with the given configuration key. * |
bool |
GetBoolean(string key) Get a boolean associated with the given configuration key. * |
byte |
GetByte(string key, byte defaultValue) Get a byte associated with the given configuration key. * |
sbyte |
GetByte(string key, sbyte defaultValue) Get a byte associated with the given configuration key. * |
sbyte |
GetByte(string key) Get a byte associated with the given configuration key. * |
double |
GetDouble(string key, double defaultValue) Get a double associated with the given configuration key. * |
double |
GetDouble(string key) Get a double associated with the given configuration key. * |
float |
GetFloat(string key, float defaultValue) Get a float associated with the given configuration key. * |
float |
GetFloat(string key) Get a float associated with the given configuration key. * |
int |
GetInt(string name, int def) The purpose of this method is to get the configuration resource with the given name as an integer, or a default value. * |
int |
GetInt(string name) The purpose of this method is to get the configuration resource with the given name as an integer. * |
int |
GetInteger(string key, int defaultValue) Get a int associated with the given configuration key. * |
int |
GetInteger(string key) Get a int associated with the given configuration key. * |
System.Collections.IEnumerator |
GetKeys(string prefix) Get the list of the keys contained in the configuration repository that match the specified prefix. * |
long |
GetLong(string key, long defaultValue) Get a long associated with the given configuration key. * |
long |
GetLong(string key) Get a long associated with the given configuration key. * |
System.Collections.Hashtable |
GetProperties(string key, System.Collections.Hashtable defaults) Get a list of properties associated with the given configuration key. * |
System.Collections.Hashtable |
GetProperties(string key) Get a list of properties associated with the given configuration key. * |
object |
GetProperty(string key) Gets a property from the configuration. * |
short |
GetShort(string key, short defaultValue) Get a short associated with the given configuration key. * |
short |
GetShort(string key) Get a short associated with the given configuration key. * |
string |
GetString(string key, string defaultValue) Get a string associated with the given configuration key. * |
string |
GetString(string key) Get a string associated with the given configuration key. * |
string[] |
GetStringArray(string key) Get an array of strings associated with the given configuration key. * |
System.Collections.ArrayList |
GetVector(string key, System.Collections.ArrayList defaultValue) Get a Vector of strings associated with the given configuration key. * |
System.Collections.ArrayList |
GetVector(string key) Get a Vector of strings associated with the given configuration key. * |
bool |
IsInitialized() Indicate to client code whether property resources have been initialized or not. |
void |
Load(System.IO.Stream input, string enc) Load the properties from the given input stream and using the specified encoding. * |
void |
Load(System.IO.Stream input) Load the properties from the given input stream. * |
void |
Save(System.IO.TextWriter output, string Header) Save the properties to the given outputstream. |
void |
SetProperty(string key, object value_Renamed) Set a property, this will replace any previously set values. Set values is implicitly a call to clearProperty(key), addProperty(key,value). |
Commons.Collections.ExtendedProperties |
Subset(string prefix) Create an ExtendedProperties object that is a subset of this one. Take into account duplicate keys by using the setProperty() in ExtendedProperties. * |
string |
TestBoolean(string value_Renamed) Test whether the string represent by value maps to a boolean value or not. We will allow true, on, and yesfor a trueboolean value, and false, off, and nofor falseboolean values. Case of value to test for boolean status is ignored. * |
string |
ToString() Display the configuration for debugging purposes. |
Methods inherited from class System.Collections.Hashtable |
---|
Add, Clear, Clone, Contains, ContainsKey, ContainsValue, CopyTo, GetEnumerator, GetHash, GetObjectData, IEnumerable.GetEnumerator, KeyEquals, OnDeserialization, Remove |
Methods inherited from class System.Object |
---|
Equals, Finalize, GetHashCode, GetType, MemberwiseClone |
Field Detail |
---|
protected internal string basePath
Base path of the configuration file used to create this ExtendedProperties object.
protected internal string file
The file connected to this repository (holding comments and such). * @serial
protected internal string fileSeparator
File separator.
protected internal string include
This is the name of the property that can point to other properties file for including other properties files.
protected internal bool isInitialized
Has this configuration been intialized.
protected internal System.Collections.ArrayList keysAsListed
These are the keys in the order they listed in the configuration file. This is useful when you wish to perform operations with configuration information in a particular order.
Constructor Detail |
---|
public ExtendedProperties()
Creates an empty extended properties object.
public ExtendedProperties(string file)
Creates and loads the extended properties from the specified file. *
Parameters:
file
- A String.
- IOException.
public ExtendedProperties(string file, string defaultFile)
Creates and loads the extended properties from the specified file. *
Parameters:
file
- A String.
- IOException.
Property Detail |
---|
public string Include
public System.Collections.IEnumerator Keys
Method Detail |
---|
public void AddProperty(string key, object token)
Add a property to the configuration. If it already exists then the value stated here will be added to the configuration entry. For example, if * resource.loader = file * is already present in the configuration and you * addProperty("resource.loader", "classpath") * Then you will end up with a Vector like the following: * ["file", "classpath"] *
Parameters:
String
- key
String
- value
public void ClearProperty(string key)
Clear a property in the configuration. *
Parameters:
String
- key to remove along with corresponding value.
public void Combine(Commons.Collections.ExtendedProperties c)
Combines an existing Hashtable with this Hashtable. * Warning: It will overwrite previous entries without warning. *
Parameters:
- ExtendedProperties
public Commons.Collections.ExtendedProperties ConvertProperties(Commons.Collections.ExtendedProperties p)
Convert a standard properties class into a configuration class. *
Parameters:
p
- properties object to convert into
a ExtendedProperties object.
*
public bool GetBoolean(string key, bool defaultValue)
Get a boolean associated with the given configuration key. *
Parameters:
key
- The configuration key.
defaultValue
- The default value.
- ClassCastException is thrown if the key maps to an
object that is not a Boolean.
public bool GetBoolean(string key)
Get a boolean associated with the given configuration key. *
Parameters:
key
- The configuration key.
- NoSuchElementException is thrown if the key doesn't
map to an existing object.
- ClassCastException is thrown if the key maps to an
object that is not a Boolean.
public byte GetByte(string key, byte defaultValue)
Get a byte associated with the given configuration key. *
Parameters:
key
- The configuration key.
defaultValue
- The default value.
- ClassCastException is thrown if the key maps to an
object that is not a Byte.
- NumberFormatException is thrown if the value mapped
by the key has not a valid number format.
public sbyte GetByte(string key, sbyte defaultValue)
Get a byte associated with the given configuration key. *
Parameters:
key
- The configuration key.
defaultValue
- The default value.
- ClassCastException is thrown if the key maps to an
object that is not a Byte.
- NumberFormatException is thrown if the value mapped
by the key has not a valid number format.
public sbyte GetByte(string key)
Get a byte associated with the given configuration key. *
Parameters:
key
- The configuration key.
- NoSuchElementException is thrown if the key doesn't
map to an existing object.
- ClassCastException is thrown if the key maps to an
object that is not a Byte.
- NumberFormatException is thrown if the value mapped
by the key has not a valid number format.
public double GetDouble(string key, double defaultValue)
Get a double associated with the given configuration key. *
Parameters:
key
- The configuration key.
defaultValue
- The default value.
- ClassCastException is thrown if the key maps to an
object that is not a Double.
- NumberFormatException is thrown if the value mapped
by the key has not a valid number format.
public double GetDouble(string key)
Get a double associated with the given configuration key. *
Parameters:
key
- The configuration key.
- NoSuchElementException is thrown if the key doesn't
map to an existing object.
- ClassCastException is thrown if the key maps to an
object that is not a Double.
- NumberFormatException is thrown if the value mapped
by the key has not a valid number format.
public float GetFloat(string key, float defaultValue)
Get a float associated with the given configuration key. *
Parameters:
key
- The configuration key.
defaultValue
- The default value.
- ClassCastException is thrown if the key maps to an
object that is not a Float.
- NumberFormatException is thrown if the value mapped
by the key has not a valid number format.
public float GetFloat(string key)
Get a float associated with the given configuration key. *
Parameters:
key
- The configuration key.
- NoSuchElementException is thrown if the key doesn't
map to an existing object.
- ClassCastException is thrown if the key maps to an
object that is not a Float.
- NumberFormatException is thrown if the value mapped
by the key has not a valid number format.
public int GetInt(string name, int def)
The purpose of this method is to get the configuration resource with the given name as an integer, or a default value. *
Parameters:
name
- The resource name
def
- The default value of the resource.
public int GetInt(string name)
The purpose of this method is to get the configuration resource with the given name as an integer. *
Parameters:
name
- The resource name.
public int GetInteger(string key, int defaultValue)
Get a int associated with the given configuration key. *
Parameters:
key
- The configuration key.
defaultValue
- The default value.
- ClassCastException is thrown if the key maps to an
object that is not a Integer.
- NumberFormatException is thrown if the value mapped
by the key has not a valid number format.
public int GetInteger(string key)
Get a int associated with the given configuration key. *
Parameters:
key
- The configuration key.
- NoSuchElementException is thrown if the key doesn't
map to an existing object.
- ClassCastException is thrown if the key maps to an
object that is not a Integer.
- NumberFormatException is thrown if the value mapped
by the key has not a valid number format.
public System.Collections.IEnumerator GetKeys(string prefix)
Get the list of the keys contained in the configuration repository that match the specified prefix. *
Parameters:
prefix
- The prefix to test against.
public long GetLong(string key, long defaultValue)
Get a long associated with the given configuration key. *
Parameters:
key
- The configuration key.
defaultValue
- The default value.
- ClassCastException is thrown if the key maps to an
object that is not a Long.
- NumberFormatException is thrown if the value mapped
by the key has not a valid number format.
public long GetLong(string key)
Get a long associated with the given configuration key. *
Parameters:
key
- The configuration key.
- NoSuchElementException is thrown if the key doesn't
map to an existing object.
- ClassCastException is thrown if the key maps to an
object that is not a Long.
- NumberFormatException is thrown if the value mapped
by the key has not a valid number format.
public System.Collections.Hashtable GetProperties(string key, System.Collections.Hashtable defaults)
Get a list of properties associated with the given configuration key. *
Parameters:
key
- The configuration key.
- ClassCastException is thrown if the key maps to an
object that is not a String/Vector.
- IllegalArgumentException if one of the tokens is
malformed (does not contain an equals sign).
public System.Collections.Hashtable GetProperties(string key)
Get a list of properties associated with the given configuration key. *
Parameters:
key
- The configuration key.
- ClassCastException is thrown if the key maps to an
object that is not a String/Vector.
- IllegalArgumentException if one of the tokens is
malformed (does not contain an equals sign).
public object GetProperty(string key)
Gets a property from the configuration. *
Parameters:
key
- property to retrieve
public short GetShort(string key, short defaultValue)
Get a short associated with the given configuration key. *
Parameters:
key
- The configuration key.
defaultValue
- The default value.
- ClassCastException is thrown if the key maps to an
object that is not a Short.
- NumberFormatException is thrown if the value mapped
by the key has not a valid number format.
public short GetShort(string key)
Get a short associated with the given configuration key. *
Parameters:
key
- The configuration key.
- NoSuchElementException is thrown if the key doesn't
map to an existing object.
- ClassCastException is thrown if the key maps to an
object that is not a Short.
- NumberFormatException is thrown if the value mapped
by the key has not a valid number format.
public string GetString(string key, string defaultValue)
Get a string associated with the given configuration key. *
Parameters:
key
- The configuration key.
defaultValue
- The default value.
- ClassCastException is thrown if the key maps to an
object that is not a String.
public string GetString(string key)
Get a string associated with the given configuration key. *
Parameters:
key
- The configuration key.
- ClassCastException is thrown if the key maps to an
object that is not a String.
public string[] GetStringArray(string key)
Get an array of strings associated with the given configuration key. *
Parameters:
key
- The configuration key.
- ClassCastException is thrown if the key maps to an
object that is not a String/Vector.
public System.Collections.ArrayList GetVector(string key, System.Collections.ArrayList defaultValue)
Get a Vector of strings associated with the given configuration key. *
Parameters:
key
- The configuration key.
defaultValue
- The default value.
- ClassCastException is thrown if the key maps to an
object that is not a Vector.
public System.Collections.ArrayList GetVector(string key)
Get a Vector of strings associated with the given configuration key. *
Parameters:
key
- The configuration key.
- ClassCastException is thrown if the key maps to an
object that is not a Vector.
public bool IsInitialized()
Indicate to client code whether property resources have been initialized or not.
public void Load(System.IO.Stream input, string enc)
Load the properties from the given input stream and using the specified encoding. *
Parameters:
input
- An InputStream.
enc
- An encoding.
- IOException.
public void Load(System.IO.Stream input)
Load the properties from the given input stream. *
Parameters:
input
- An InputStream.
- IOException.
public void Save(System.IO.TextWriter output, string Header)
Save the properties to the given outputstream.
Parameters:
output
- An OutputStream.
header
- A String.
- IOException.
public void SetProperty(string key, object value_Renamed)
Set a property, this will replace any previously set values. Set values is implicitly a call to clearProperty(key), addProperty(key,value).
Parameters:
String
- key
String
- value
public Commons.Collections.ExtendedProperties Subset(string prefix)
Create an ExtendedProperties object that is a subset of this one. Take into account duplicate keys by using the setProperty() in ExtendedProperties. *
Parameters:
String
- prefix
public string TestBoolean(string value_Renamed)
Test whether the string represent by value maps to a boolean value or not. We will allow
true,
on, and
yesfor a
trueboolean value, and
false,
off, and
nofor
falseboolean values. Case of value to test for boolean status is ignored. *
Parameters:
String
- The value to test for boolean state.
trueor
falseif the supplied text maps to a boolean value, or
nullotherwise.
public string ToString()
Display the configuration for debugging purposes.
|
.NET Framework | |||||||||
PREV TYPE NEXT TYPE | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONST | PROP | METHOD | OP | EVENT | DETAIL: FIELD | CONST | PROP | METHOD | OP | EVENT |