C# Class Spring.Objects.Factory.Config.VariableAccessor

Provides methods for type-safe accessing IVariableSources.
Exibir arquivo Open project: spring-projects/spring-net Class Usage Examples

Public Methods

Method Description
GetBoolean ( string name, bool defaultValue ) : bool

Returns a bool that contains the value of the specified variable.

GetBoolean ( string name, bool defaultValue, bool throwOnInvalidValue ) : bool

Returns a bool that contains the value of the specified variable.

GetByte ( string name, byte defaultValue ) : byte

Returns a byte that contains the value of the specified variable.

GetByte ( string name, byte defaultValue, bool throwOnInvalidValue ) : byte

Returns a byte that contains the value of the specified variable.

GetChar ( string name, char defaultValue ) : char

Returns a char that contains the value of the specified variable.

GetChar ( string name, char defaultValue, bool throwOnInvalidValue ) : char

Returns a char that contains the value of the specified variable.

GetDateTime ( string name, string format, System.DateTime defaultValue ) : System.DateTime

Returns a DateTime that contains the value of the specified variable.

GetDateTime ( string name, string format, System.DateTime defaultValue, bool throwOnInvalidValue ) : System.DateTime

Returns a DateTime that contains the value of the specified variable.

GetDecimal ( string name, decimal defaultValue ) : decimal

Returns a decimal that contains the value of the specified variable.

GetDecimal ( string name, decimal defaultValue, bool throwOnInvalidValue ) : decimal

Returns a decimal that contains the value of the specified variable.

GetDouble ( string name, double defaultValue ) : double

Returns a double that contains the value of the specified variable.

GetDouble ( string name, double defaultValue, bool throwOnInvalidValue ) : double

Returns a double that contains the value of the specified variable.

GetEnum ( string name, Enum defaultValue ) : Enum

Returns an Enum of defaultValue's type that contains the value of the specified variable.

GetEnum ( string name, Enum defaultValue, bool throwOnInvalidValue ) : Enum

Returns an Enum of defaultValue's type that contains the value of the specified variable.

GetFloat ( string name, float defaultValue ) : float

Returns a float that contains the value of the specified variable.

GetFloat ( string name, float defaultValue, bool throwOnInvalidValue ) : float

Returns a float that contains the value of the specified variable.

GetGuid ( string name, System.Guid defaultValue ) : System.Guid

Returns a Guid that contains the value of the specified variable.

GetGuid ( string name, System.Guid defaultValue, bool throwOnInvalidValue ) : System.Guid

Returns a Guid that contains the value of the specified variable.

GetInt16 ( string name, short defaultValue ) : short

Returns a short that contains the value of the specified variable.

GetInt16 ( string name, short defaultValue, bool throwOnInvalidValue ) : short

Returns a short that contains the value of the specified variable.

GetInt32 ( string name, int defaultValue ) : int

Returns a int that contains the value of the specified variable.

GetInt32 ( string name, int defaultValue, bool throwOnInvalidValue ) : int

Returns a int that contains the value of the specified variable.

GetInt64 ( string name, long defaultValue ) : long

Returns a long that contains the value of the specified variable.

GetInt64 ( string name, long defaultValue, bool throwOnInvalidValue ) : long

Returns a long that contains the value of the specified variable.

GetString ( string name, string defaultValue ) : string

Returns a string that contains the value of the specified variable.

VariableAccessor ( IVariableSource variableSource ) : System

Initialize a new instance of an VariableAccessor

Private Methods

Method Description
GetUInt16 ( string name, ushort defaultValue ) : ushort
GetUInt16 ( string name, ushort defaultValue, bool throwOnInvalidValue ) : ushort
GetUInt32 ( string name, uint defaultValue ) : uint
GetUInt32 ( string name, uint defaultValue, bool throwOnInvalidValue ) : uint
GetUInt64 ( string name, ulong defaultValue ) : ulong
GetUInt64 ( string name, ulong defaultValue, bool throwOnInvalidValue ) : ulong

Method Details

GetBoolean() public method

Returns a bool that contains the value of the specified variable.
public GetBoolean ( string name, bool defaultValue ) : bool
name string The name of the variable to be read.
defaultValue bool The value to be returned if returns null.
return bool

GetBoolean() public method

Returns a bool that contains the value of the specified variable.
public GetBoolean ( string name, bool defaultValue, bool throwOnInvalidValue ) : bool
name string The name of the variable to be read.
defaultValue bool The value to be returned if returns null.
throwOnInvalidValue bool /// If false, suppresses exceptions if the result /// of cannot be parsed /// and returns instead.
return bool

GetByte() public method

Returns a byte that contains the value of the specified variable.
public GetByte ( string name, byte defaultValue ) : byte
name string The name of the variable to be read.
defaultValue byte The value to be returned if returns null.
return byte

GetByte() public method

Returns a byte that contains the value of the specified variable.
public GetByte ( string name, byte defaultValue, bool throwOnInvalidValue ) : byte
name string The name of the variable to be read.
defaultValue byte The value to be returned if returns null.
throwOnInvalidValue bool /// If false, suppresses exceptions if the result /// of cannot be parsed /// and returns instead.
return byte

GetChar() public method

Returns a char that contains the value of the specified variable.
public GetChar ( string name, char defaultValue ) : char
name string The name of the variable to be read.
defaultValue char The value to be returned if returns null.
return char

GetChar() public method

Returns a char that contains the value of the specified variable.
public GetChar ( string name, char defaultValue, bool throwOnInvalidValue ) : char
name string The name of the variable to be read.
defaultValue char The value to be returned if returns null.
throwOnInvalidValue bool /// If false, suppresses exceptions if the result /// of cannot be parsed /// and returns instead.
return char

GetDateTime() public method

Returns a DateTime that contains the value of the specified variable.
public GetDateTime ( string name, string format, System.DateTime defaultValue ) : System.DateTime
name string The name of the variable to be read.
format string The expected format of the variable's value
defaultValue System.DateTime The value to be returned if returns null.
return System.DateTime

GetDateTime() public method

Returns a DateTime that contains the value of the specified variable.
public GetDateTime ( string name, string format, System.DateTime defaultValue, bool throwOnInvalidValue ) : System.DateTime
name string The name of the variable to be read.
format string The expected format of the variable's value
defaultValue System.DateTime The value to be returned if returns null.
throwOnInvalidValue bool /// If false, suppresses exceptions if the result /// of cannot be parsed /// and returns instead.
return System.DateTime

GetDecimal() public method

Returns a decimal that contains the value of the specified variable.
public GetDecimal ( string name, decimal defaultValue ) : decimal
name string The name of the variable to be read.
defaultValue decimal The value to be returned if returns null.
return decimal

GetDecimal() public method

Returns a decimal that contains the value of the specified variable.
public GetDecimal ( string name, decimal defaultValue, bool throwOnInvalidValue ) : decimal
name string The name of the variable to be read.
defaultValue decimal The value to be returned if returns null.
throwOnInvalidValue bool /// If false, suppresses exceptions if the result /// of cannot be parsed /// and returns instead.
return decimal

GetDouble() public method

Returns a double that contains the value of the specified variable.
public GetDouble ( string name, double defaultValue ) : double
name string The name of the variable to be read.
defaultValue double The value to be returned if returns null.
return double

GetDouble() public method

Returns a double that contains the value of the specified variable.
public GetDouble ( string name, double defaultValue, bool throwOnInvalidValue ) : double
name string The name of the variable to be read.
defaultValue double The value to be returned if returns null.
throwOnInvalidValue bool /// If false, suppresses exceptions if the result /// of cannot be parsed /// and returns instead.
return double

GetEnum() public method

Returns an Enum of defaultValue's type that contains the value of the specified variable.
public GetEnum ( string name, Enum defaultValue ) : Enum
name string The name of the variable to be read.
defaultValue System.Enum The value to be returned if returns null.
return System.Enum

GetEnum() public method

Returns an Enum of defaultValue's type that contains the value of the specified variable.
public GetEnum ( string name, Enum defaultValue, bool throwOnInvalidValue ) : Enum
name string The name of the variable to be read.
defaultValue System.Enum The value to be returned if returns null.
throwOnInvalidValue bool /// If false, suppresses exceptions if the result /// of cannot be parsed /// and returns instead.
return System.Enum

GetFloat() public method

Returns a float that contains the value of the specified variable.
public GetFloat ( string name, float defaultValue ) : float
name string The name of the variable to be read.
defaultValue float The value to be returned if returns null.
return float

GetFloat() public method

Returns a float that contains the value of the specified variable.
public GetFloat ( string name, float defaultValue, bool throwOnInvalidValue ) : float
name string The name of the variable to be read.
defaultValue float The value to be returned if returns null.
throwOnInvalidValue bool /// If false, suppresses exceptions if the result /// of cannot be parsed /// and returns instead.
return float

GetGuid() public method

Returns a Guid that contains the value of the specified variable.
public GetGuid ( string name, System.Guid defaultValue ) : System.Guid
name string The name of the variable to be read.
defaultValue System.Guid The value to be returned if returns null.
return System.Guid

GetGuid() public method

Returns a Guid that contains the value of the specified variable.
public GetGuid ( string name, System.Guid defaultValue, bool throwOnInvalidValue ) : System.Guid
name string The name of the variable to be read.
defaultValue System.Guid The value to be returned if returns null.
throwOnInvalidValue bool /// If false, suppresses exceptions if the result /// of cannot be parsed /// and returns instead.
return System.Guid

GetInt16() public method

Returns a short that contains the value of the specified variable.
public GetInt16 ( string name, short defaultValue ) : short
name string The name of the variable to be read.
defaultValue short The value to be returned if returns null.
return short

GetInt16() public method

Returns a short that contains the value of the specified variable.
public GetInt16 ( string name, short defaultValue, bool throwOnInvalidValue ) : short
name string The name of the variable to be read.
defaultValue short The value to be returned if returns null.
throwOnInvalidValue bool /// If false, suppresses exceptions if the result /// of cannot be parsed /// and returns instead.
return short

GetInt32() public method

Returns a int that contains the value of the specified variable.
public GetInt32 ( string name, int defaultValue ) : int
name string The name of the variable to be read.
defaultValue int The value to be returned if returns null.
return int

GetInt32() public method

Returns a int that contains the value of the specified variable.
public GetInt32 ( string name, int defaultValue, bool throwOnInvalidValue ) : int
name string The name of the variable to be read.
defaultValue int The value to be returned if returns null.
throwOnInvalidValue bool /// If false, suppresses exceptions if the result /// of cannot be parsed /// and returns instead.
return int

GetInt64() public method

Returns a long that contains the value of the specified variable.
public GetInt64 ( string name, long defaultValue ) : long
name string The name of the variable to be read.
defaultValue long The value to be returned if returns null.
return long

GetInt64() public method

Returns a long that contains the value of the specified variable.
public GetInt64 ( string name, long defaultValue, bool throwOnInvalidValue ) : long
name string The name of the variable to be read.
defaultValue long The value to be returned if returns null.
throwOnInvalidValue bool /// If false, suppresses exceptions if the result /// of cannot be parsed /// and returns instead.
return long

GetString() public method

Returns a string that contains the value of the specified variable.
public GetString ( string name, string defaultValue ) : string
name string The name of the variable to be read.
defaultValue string The value to be returned if returns or .
return string

VariableAccessor() public method

Initialize a new instance of an VariableAccessor
public VariableAccessor ( IVariableSource variableSource ) : System
variableSource IVariableSource The underlying to read values from.
return System