Diffusion .NET Classic API - Core and Common  5.9.4
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Events
PushTechnology.DiffusionCore.PropertyHandler.IPropertyHandler Interface Reference

A Property Handler provides an interface to a set of properties. More...

Inheritance diagram for PushTechnology.DiffusionCore.PropertyHandler.IPropertyHandler:
PushTechnology.DiffusionCore.PropertyHandler.PropertyHandlerImpl PushTechnology.DiffusionCore.PropertyHandler.BaseProperties PushTechnology.DiffusionCore.PropertyHandlers.DiffusionProperties

Public Member Functions

bool PropertyExists (string key)
 Indicates whether a value for a particular property exists. More...
 
string GetProperty (string key)
 Get a property. More...
 
string GetProperty (string key, string defaultValue)
 Get a property if it exists, otherwise return a default value. More...
 
string GetProperty (string key, string defaultValue, params string[] allowedValues)
 Get a property if it exists and validate it against a set of allowed values. More...
 
string GetMandatoryProperty (string key)
 Get a mandatory property. More...
 
void SetProperty (string key, string value)
 Sets a property value. More...
 
int GetIntegerProperty (string key)
 Get an integer property. More...
 
int GetIntegerProperty (string key, int defaultValue)
 Get an integer property if it exists, otherwise return a default value. More...
 
long GetLongProperty (string key)
 Get a long property. More...
 
long GetLongProperty (string key, long defaultValue)
 Get a long property if it exists, otherwise return a default value. More...
 
List< string > GetListProperty (string key)
 Gets the value of a list property. More...
 
ISet< string > GetSetProperty (string key)
 Gets the value of a set property. More...
 
bool GetBooleanProperty (string key)
 Gets the value of a boolean property. More...
 

Detailed Description

A Property Handler provides an interface to a set of properties.

Such properties are typically loaded from a properties file.

Member Function Documentation

bool PushTechnology.DiffusionCore.PropertyHandler.IPropertyHandler.GetBooleanProperty ( string  key)

Gets the value of a boolean property.

Parameters
keyThe property key.
Returns
true if the property value is 'true' (in any case) or false if the property does not exist or is set to any other value.

Implemented in PushTechnology.DiffusionCore.PropertyHandler.PropertyHandlerImpl.

int PushTechnology.DiffusionCore.PropertyHandler.IPropertyHandler.GetIntegerProperty ( string  key)

Get an integer property.

Parameters
keyThe property key.
Returns
The property value.

Implemented in PushTechnology.DiffusionCore.PropertyHandler.PropertyHandlerImpl.

int PushTechnology.DiffusionCore.PropertyHandler.IPropertyHandler.GetIntegerProperty ( string  key,
int  defaultValue 
)

Get an integer property if it exists, otherwise return a default value.

Parameters
keyThe property key.
defaultValueThe value to return if the property does not exist.
Returns
The property value or the default value if the property did not exist.

Implemented in PushTechnology.DiffusionCore.PropertyHandler.PropertyHandlerImpl.

List<string> PushTechnology.DiffusionCore.PropertyHandler.IPropertyHandler.GetListProperty ( string  key)

Gets the value of a list property.

A list property is interpreted as a list of values separated by ampersand characters.

If you wish to eliminate duplicates from a list then use 'GetSetProperty( string )'.

Parameters
keyThe property key.
Returns
The list of property values. If the property did not exist or was zero length or whitespace then an empty list will be returned.

Implemented in PushTechnology.DiffusionCore.PropertyHandler.PropertyHandlerImpl.

long PushTechnology.DiffusionCore.PropertyHandler.IPropertyHandler.GetLongProperty ( string  key)

Get a long property.

Parameters
keyThe property key.
Returns
The property value.

Implemented in PushTechnology.DiffusionCore.PropertyHandler.PropertyHandlerImpl.

long PushTechnology.DiffusionCore.PropertyHandler.IPropertyHandler.GetLongProperty ( string  key,
long  defaultValue 
)

Get a long property if it exists, otherwise return a default value.

Parameters
keyThe property key.
defaultValueThe value to return if the property does not exist.
Returns
The property value or the default value if the property did not exist.

Implemented in PushTechnology.DiffusionCore.PropertyHandler.PropertyHandlerImpl.

string PushTechnology.DiffusionCore.PropertyHandler.IPropertyHandler.GetMandatoryProperty ( string  key)

Get a mandatory property.

Parameters
keyThe property key.
Returns
The property value.

Implemented in PushTechnology.DiffusionCore.PropertyHandler.PropertyHandlerImpl.

string PushTechnology.DiffusionCore.PropertyHandler.IPropertyHandler.GetProperty ( string  key)

Get a property.

Parameters
keyThe property key.
Returns
The property value, or null if the property was not found or is zero length or whitespace.

Implemented in PushTechnology.DiffusionCore.PropertyHandler.BaseProperties, and PushTechnology.DiffusionCore.PropertyHandler.PropertyHandlerImpl.

string PushTechnology.DiffusionCore.PropertyHandler.IPropertyHandler.GetProperty ( string  key,
string  defaultValue 
)

Get a property if it exists, otherwise return a default value.

Parameters
keyThe property key.
defaultValueThe default value to return if the property is not declared.
Returns
The property value or the default value if the property is not declared.

Implemented in PushTechnology.DiffusionCore.PropertyHandler.PropertyHandlerImpl.

string PushTechnology.DiffusionCore.PropertyHandler.IPropertyHandler.GetProperty ( string  key,
string  defaultValue,
params string[]  allowedValues 
)

Get a property if it exists and validate it against a set of allowed values.

If the property does not exist then a default value is returned.

Parameters
keyThe property key.
defaultValueThe default value to return if the property is not declared.
allowedValuesA list of permitted values. If this list is not supplied then any value would be permitted. The case of the values is not significant and thus any of the values is permitted in any case.
Returns
The property value or the default value if the property is not declared. Note that even though case is ignored in validation the property values are returned 'as is' and the caller may want to homogenise the case of the returned value before checking it.

Implemented in PushTechnology.DiffusionCore.PropertyHandler.PropertyHandlerImpl.

ISet<string> PushTechnology.DiffusionCore.PropertyHandler.IPropertyHandler.GetSetProperty ( string  key)

Gets the value of a set property.

A set property is interpreted as a list of values separated by ampersand characters. This differs from a list property in that because a set is returned, duplicates are removed. The set order is the same as the list within the properties.

Parameters
keyThe property key.
Returns
The set of property values. If the property did not exist or was zero length or whitespace then an empty set will be returned.

Implemented in PushTechnology.DiffusionCore.PropertyHandler.PropertyHandlerImpl.

bool PushTechnology.DiffusionCore.PropertyHandler.IPropertyHandler.PropertyExists ( string  key)

Indicates whether a value for a particular property exists.

Parameters
keyThe property key.
Returns
true if the property value exists and is not zero length or whitespace, false if the property does not exist or is zero length or whitespace.

Implemented in PushTechnology.DiffusionCore.PropertyHandler.PropertyHandlerImpl.

void PushTechnology.DiffusionCore.PropertyHandler.IPropertyHandler.SetProperty ( string  key,
string  value 
)

Sets a property value.

Parameters
keyThe property key.
valueThe property value.

Implemented in PushTechnology.DiffusionCore.PropertyHandler.PropertyHandlerImpl.