org.terracotta.toolkit.config
Interface Configuration

All Known Implementing Classes:
AbstractConfiguration

public interface Configuration

A generic configuration object whose behavior is same as that of map but can store only literal values. The getters of this class return the value only if the config contains a mapping for that name with the correct type. An IllegalArgumentException is thrown otherwise.


Method Summary
 boolean getBoolean(String name)
          Get a config for the name parameter.
 int getInt(String name)
          Get a config for the name parameter.
 Set<String> getKeys()
          Gets the configuration field names present in this config instance
 long getLong(String name)
          Get a config for the name parameter.
 Serializable getObjectOrNull(String name)
          Gets the value for the configuration field name name
 String getString(String name)
          Get a config for the name parameter.
 boolean hasField(String name)
          Returns true if the config contains a mapping for specified name
 

Method Detail

hasField

boolean hasField(String name)
Returns true if the config contains a mapping for specified name

Returns:
true if the config contains a mapping for specified name, otherwise false

getInt

int getInt(String name)
           throws IllegalArgumentException
Get a config for the name parameter.

Returns:
an int value if and only if name is mapped to an int value
Throws:
IllegalArgumentException - if no mapping exists with name or it exists but value is not of type int

getLong

long getLong(String name)
             throws IllegalArgumentException
Get a config for the name parameter.

Returns:
a long value if and only if name is mapped to a long value
Throws:
IllegalArgumentException - if no mapping exists with name or it exists but value is not of type long

getBoolean

boolean getBoolean(String name)
                   throws IllegalArgumentException
Get a config for the name parameter.

Returns:
a boolean value if and only if name is mapped to a boolean value
Throws:
IllegalArgumentException - if no mapping exists with name or it exists but value is not of type boolean

getString

String getString(String name)
                 throws IllegalArgumentException
Get a config for the name parameter.

Returns:
a string value if and only if name is mapped to a string value
Throws:
IllegalArgumentException - if no mapping exists with name or it exists but value is not of type string

getKeys

Set<String> getKeys()
Gets the configuration field names present in this config instance

Returns:
a set containing all mappings in this configuration object

getObjectOrNull

Serializable getObjectOrNull(String name)
Gets the value for the configuration field name name

Returns:
value mapped to name if present, otherwise null


Copyright © 2014 Terracotta, Inc.. All Rights Reserved.