org.apache.any23.configuration
Interface Configuration

All Known Subinterfaces:
ModifiableConfiguration
All Known Implementing Classes:
DefaultConfiguration, DefaultModifiableConfiguration

public interface Configuration

Defines the main Any23 configuration.


Method Summary
 boolean defineProperty(String propertyName)
          Checks whether a property is defined or not in configuration.
 String getConfigurationDump()
          Returns a human readable string containing the configuration dump.
 boolean getFlagProperty(String propertyName)
          Returns the value of a flag property.
 String[] getProperties()
          Returns all the defined configuration properties.
 String getProperty(String propertyName, String defaultValue)
          Returns the value of a specified property, of the default value if property is not defined.
 int getPropertyIntOrFail(String propertyName)
          Returns the Integer value of the specified propertyName or raises an exception if propertyName is not defined.
 String getPropertyOrFail(String propertyName)
          Returns the value of the specified propertyName or raises an exception if propertyName is not defined.
 

Method Detail

getProperties

String[] getProperties()
Returns all the defined configuration properties.

Returns:
list of defined properties.

defineProperty

boolean defineProperty(String propertyName)
Checks whether a property is defined or not in configuration.

Parameters:
propertyName - name of property to check.
Returns:
true if defined, false otherwise.

getProperty

String getProperty(String propertyName,
                   String defaultValue)
Returns the value of a specified property, of the default value if property is not defined.

Parameters:
propertyName - name of property
defaultValue - default value if not found.
Returns:
the value associated to propertyName.

getPropertyOrFail

String getPropertyOrFail(String propertyName)
Returns the value of the specified propertyName or raises an exception if propertyName is not defined.

Parameters:
propertyName - name of property to be returned.
Returns:
property value.
Throws:
IllegalArgumentException - if the property name is not defined or the found property value is blank or empty.

getPropertyIntOrFail

int getPropertyIntOrFail(String propertyName)
Returns the Integer value of the specified propertyName or raises an exception if propertyName is not defined.

Parameters:
propertyName - name of property to be returned.
Returns:
property value.
Throws:
NullPointerException - if the property name is not defined.
IllegalArgumentException - if the found property value is blank or empty.
NumberFormatException - if the found property value is not a valid Integer.

getFlagProperty

boolean getFlagProperty(String propertyName)
Returns the value of a flag property. Such properties can assume only two values:
  • on if flag is active (true is returned).
  • off if flag is inactive (false is returned).

Parameters:
propertyName - name of property flag.
Returns:
true for on, false for off.
Throws:
IllegalArgumentException - if the propertyName is not declared.

getConfigurationDump

String getConfigurationDump()
Returns a human readable string containing the configuration dump.

Returns:
a string describing the configuration options.


Copyright © 2010-2012 The Apache Software Foundation. All Rights Reserved.