Oracle® Fusion Middleware .NET API Reference for Identity Connector Framework  E57662-01
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties
Public Member Functions | Package Functions | List of all members
Org.IdentityConnectors.Test.Common.PropertyBag Class Reference

Encapsulates a read-only bag of properties, which can be accessed in a type-safe manner. More...

Public Member Functions

GetProperty< T > (string name)
 Gets the value of a required property defined by name in a type-safe manner. More...
 
GetProperty< T > (string name, T def)
 Gets a property value, returning a default value when no property with the specified name exists in the bag. More...
 
string GetStringProperty (string name)
 Gets a required property value known to be of type String. More...
 

Package Functions

 PropertyBag (IDictionary< string, object > bag)
 Initializes a new instance of the PropertyBag class with the properties. More...
 
IDictionary< string, object > ToDictionary ()
 Returns a key-value pair collection that represents the current T:PropertyBag. More...
 

Detailed Description

Encapsulates a read-only bag of properties, which can be accessed in a type-safe manner.

The simplest way to obtain a required (i.e., the property must be in the bag, otherwise an exception is thrown) property value is PropertyBag.GetProperty{T}(string). If the property is not a required one, the PropertyBag.GetProperty{T}(string, T) method can be used, which also takes a default value which is returned when the property is not present in the bag.

Constructor & Destructor Documentation

Org.IdentityConnectors.Test.Common.PropertyBag.PropertyBag ( IDictionary< string, object >  bag)
package

Initializes a new instance of the PropertyBag class with the properties.

Parameters
bagThe properties contained in the bag.

Member Function Documentation

T Org.IdentityConnectors.Test.Common.PropertyBag.GetProperty< T > ( string  name)

Gets the value of a required property defined by name in a type-safe manner.

Template Parameters
TThe type of the property to get.
Parameters
nameThe name of the property.
Returns
The value of the property in bag; the value might be null.
Exceptions
ArgumentExceptionThrown when no property found defined by name
InvalidCastExceptionThrown when the property exists, but its value is not of type T .

See PropertyBag.CastValue{T}(string) for details on the types that can be defined in T .

T Org.IdentityConnectors.Test.Common.PropertyBag.GetProperty< T > ( string  name,
def 
)

Gets a property value, returning a default value when no property with the specified name exists in the bag.

Template Parameters
TThe type of the property to get.
Parameters
nameThe name of the property.
defThe default value returned when no property with the specified name exists in the bag.
Returns
The value of the property in bag cast to type T or the default value def ; the value might be null.
Exceptions
InvalidCastExceptionThrown when the property exists, but its value is not of type T .

See PropertyBag.CastValue{T}(string) for details on the types that can be defined in T .

string Org.IdentityConnectors.Test.Common.PropertyBag.GetStringProperty ( string  name)

Gets a required property value known to be of type String.

Parameters
nameThe name of the property.
Returns
The value of the property in bag; the value might be null.
Exceptions
ArgumentExceptionThrown when no property found defined by name
InvalidCastExceptionThrown when the property exists, but its value is not of type String.

The method expects that the value is an instance of String. It does not attempt to call Object.ToString() on the value.

IDictionary<string, object> Org.IdentityConnectors.Test.Common.PropertyBag.ToDictionary ( )
package

Returns a key-value pair collection that represents the current T:PropertyBag.

Returns
A IDictionary{T,U} instance that represents the current T:PropertyBag.

The documentation for this class was generated from the following file: