Package org.apache.any23.configuration
Interface Configuration
-
- All Known Subinterfaces:
ModifiableConfiguration
- All Known Implementing Classes:
DefaultConfiguration,DefaultModifiableConfiguration
public interface ConfigurationDefines the main Any23 configuration.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description booleandefineProperty(String propertyName)Checks whether a property is defined or not in configuration.StringgetConfigurationDump()Returns a human readable string containing the configuration dump.booleangetFlagProperty(String propertyName)Returns the value of a flag property.String[]getProperties()Returns all the defined configuration properties.StringgetProperty(String propertyName, String defaultValue)Returns the value of a specified property, of the default value if property is not defined.intgetPropertyIntOrFail(String propertyName)Returns theIntegervalue of the specifiedpropertyNameor raises an exception ifpropertyNameis not defined.StringgetPropertyOrFail(String propertyName)Returns the value of the specifiedpropertyNameor raises an exception ifpropertyNameis 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:
trueif defined,falseotherwise.
-
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 propertydefaultValue- default value if not found.- Returns:
- the value associated to propertyName.
-
getPropertyOrFail
String getPropertyOrFail(String propertyName)
Returns the value of the specifiedpropertyNameor raises an exception ifpropertyNameis 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 theIntegervalue of the specifiedpropertyNameor raises an exception ifpropertyNameis 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 validInteger.
-
getFlagProperty
boolean getFlagProperty(String propertyName)
Returns the value of a flag property. Such properties can assume only two values:onif flag is active (trueis returned).offif flag is inactive (falseis returned).
- Parameters:
propertyName- name of property flag.- Returns:
trueforon,falseforoff.- Throws:
IllegalArgumentException- if thepropertyNameis not declared.
-
getConfigurationDump
String getConfigurationDump()
Returns a human readable string containing the configuration dump.- Returns:
- a string describing the configuration options.
-
-