Package 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
All Methods Instance Methods Abstract Methods Modifier and Type Method Description 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 theInteger
value of the specifiedpropertyName
or raises an exception ifpropertyName
is not defined.String
getPropertyOrFail(String propertyName)
Returns the value of the specifiedpropertyName
or raises an exception ifpropertyName
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 propertydefaultValue
- default value if not found.- Returns:
- the value associated to propertyName.
-
getPropertyOrFail
String getPropertyOrFail(String propertyName)
Returns the value of the specifiedpropertyName
or raises an exception ifpropertyName
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 theInteger
value of the specifiedpropertyName
or raises an exception ifpropertyName
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 validInteger
.
-
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
foron
,false
foroff
.- Throws:
IllegalArgumentException
- if thepropertyName
is not declared.
-
getConfigurationDump
String getConfigurationDump()
Returns a human readable string containing the configuration dump.- Returns:
- a string describing the configuration options.
-
-