eu.planets_project.ifr.core.common.conf
Interface Configuration


public interface Configuration

Represent the results of processing a properties file. Contains zero or more properties that can be retrieved by their key.


Method Summary
 int getInteger(java.lang.String key)
          Get the value of a property with a given key as a number (int).
 int getInteger(java.lang.String key, int defaultValue)
          Get the value of a property with a given key.
 java.util.Iterator<java.lang.String> getKeys()
          Get an iterator over all the keys in the configuration
 java.lang.String getString(java.lang.String key)
          Get the value of a property with a given key.
 java.lang.String getString(java.lang.String key, java.lang.String defaultValue)
          Get the value of a property with a given key.
 java.net.URI getURI(java.lang.String key)
          Get the value of a property with a given key as a URI.
 java.net.URI getURI(java.lang.String key, java.net.URI defaultValue)
          Get the value of a property with a given key as a URI.
 

Method Detail

getString

java.lang.String getString(java.lang.String key)
Get the value of a property with a given key.

Parameters:
key - Determines which property to get the value for.
Returns:
The value matching the given key.
Throws:
java.util.NoSuchElementException - if the given key is not in the properties file.

getString

java.lang.String getString(java.lang.String key,
                           java.lang.String defaultValue)
Get the value of a property with a given key. If it doesn't exist, return the default value

Parameters:
key - Determines which property to get the value for.
defaultValue - Returned if the key is not found.
Returns:
The value matching the given key (or the default if no value found).

getInteger

int getInteger(java.lang.String key)
Get the value of a property with a given key as a number (int).

Parameters:
key - Determines which property to get the value for.
Returns:
The value matching the given key, converted to an 'int'
Throws:
java.util.NoSuchElementException - If the given key is not in the properties file.
ConversionException - If the String value of the property cannot be converted to an 'int'

getInteger

int getInteger(java.lang.String key,
               int defaultValue)
Get the value of a property with a given key. If it doesn't exist, return the default value.

Parameters:
key - Determines which property to get the value for.
defaultValue - Returned if the key is not found.
Returns:
The value matching the given key (or the default if no value found).
Throws:
ConversionException - If the String value of the property cannot be converted to an 'int'

getURI

java.net.URI getURI(java.lang.String key)
Get the value of a property with a given key as a URI.

Parameters:
key - Determines which property to get the value for.
Returns:
The value matching the given key, converted to a URI
Throws:
java.util.NoSuchElementException - If the given key is not in the properties file.
ConversionException - If the String value of the property cannot be converted to a URI

getURI

java.net.URI getURI(java.lang.String key,
                    java.net.URI defaultValue)
Get the value of a property with a given key as a URI. If it doesn't exist, return the default value.

Parameters:
key - Determines which property to get the value for.
defaultValue - Returned if the key is not found.
Returns:
The value matching the given key, converted to a URI
Throws:
java.util.NoSuchElementException - If the given key is not in the properties file.
ConversionException - If the String value of the property cannot be converted to a URI

getKeys

java.util.Iterator<java.lang.String> getKeys()
Get an iterator over all the keys in the configuration

Returns:
An iterator for a collection of the keys configured


Copyright © 2007-2010 The Planets Consortium. All Rights Reserved.