Map

com.kesoftware.imu.Map

com.kesoftware.imu.Map

Since: 1.0

Description

Provides a simple map class with string keys and a set of convenience methods for getting values of certain types.

Methods

Method

Details

getArray(name, type)

<T> T[] getArray(String name, Class<T[]> type)

Gets the value associated with the key name and returns it as an array of the type specified by type.

Parameters:

name (String)

The key whose associated value is to be returned.

type (Class<T[]>)

The type of the array required.

Returns:

<T> T[] mixed

The correctly typed array.

getBoolean(name)

boolean getBoolean(String name)

Gets the value associated with the key name and returns it as a Boolean.

Parameters:

name (String)

The key whose associated value is to be returned.

Returns:

Boolean

The value, interpreted as a Boolean. Null values are considered false. Numeric values are considered false if they evaluate to 0, and true otherwise. Any other non-Boolean value is converted to a String and then parsed as a Boolean.

getDouble(name)

double getDouble(String name)

Gets the value associated with the key name and returns it as a double precision floating point number.

Parameters:

name (String)

The key whose associated value is to be returned.

Returns:

double

The value, interpreted as a double. Null values evaluate to 0. Boolean values evaluate to 0 if false and 1 if true. Any other non-numeric value is converted to a String and then parsed as a Double.

getInt(name)

int getInt(String name)

Gets the value associated with the key name and returns it as an int.

Parameters:

name (String)

The key whose associated value is to be returned.

Returns:

int

The value, interpreted as an int. Null values evaluate to 0. Boolean values evaluate to 0 if false and 1 if true. Any other non-numeric value is converted to a String and then parsed as an int.

getLong(name)

long getLong(String name)

Gets the value associated with the key name and returns it as a long.

Parameters:

name (String)

The key whose associated value is to be returned.

Returns:

long

The value, interpreted as a long. Null values evaluate to 0. Boolean values evaluate to 0 if false and 1 if true. Any other non-numeric value is converted to a String and then parsed as a long.

getMap(name)

Map getMap(String name)

Gets the value associated with the key name and returns it as an IMu Map object.

Parameters:

name (String)

The key whose associated value is to be returned.

Returns:

Map

The value, cast to a Map.

getMaps(name)

Map[] getMaps(String name)

Gets the value associated with the key name and returns it as an array of IMu Map objects. This is a short-hand for:

Parameters:

name (String)

The key whose associated value is to be returned.

Returns:

Map[]

The value, converted to a Map[].

getString(name)

String getString(String name)

Gets the value associated with the key name and returns it as a String.

Parameters:

name (String)

The key whose associated value is to be returned.

Returns:

String

The value, interpreted as a String. Null values remain null. Any other non-string value is converted to a String using the object's toString( ) method.

getStrings(name)

String[] getStrings(String name)

Gets the value associated with the key name and returns it as an array of Strings. This is a short-hand for:

Parameters:

name (String)

The key whose associated value is to be returned.

Returns:

String[]

The value, converted to a String[].