Class SourcePropertiesImpl
- java.lang.Object
-
- net.officefloor.frame.impl.construct.source.SourcePropertiesImpl
-
- All Implemented Interfaces:
SourceProperties
- Direct Known Subclasses:
PropertyListSourceProperties
,SourceContextImpl
public class SourcePropertiesImpl extends java.lang.Object implements SourceProperties
SourceProperties
implementation.- Author:
- Daniel Sagenschneider
-
-
Constructor Summary
Constructors Constructor Description SourcePropertiesImpl()
Initiate empty property list.SourcePropertiesImpl(java.lang.String... propertyNameValuePairs)
Convenience constructor for use in unit testing to instantiate a ready to use instance.SourcePropertiesImpl(SourceProperties sourceProperties)
Initiate to contain the inputSourceProperties
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addProperty(java.lang.String name, java.lang.String value)
Adds a property.java.util.Properties
getProperties()
Properties to configure the source.java.lang.String
getProperty(java.lang.String name)
Obtains a required property value.java.lang.String
getProperty(java.lang.String name, java.lang.String defaultValue)
Obtains the property value or subsequently the default value.java.lang.String[]
getPropertyNames()
Obtains the names of the available properties in the order they were defined.
-
-
-
Constructor Detail
-
SourcePropertiesImpl
public SourcePropertiesImpl()
Initiate empty property list.
-
SourcePropertiesImpl
public SourcePropertiesImpl(SourceProperties sourceProperties)
Initiate to contain the inputSourceProperties
.- Parameters:
sourceProperties
-SourceProperties
.
-
SourcePropertiesImpl
public SourcePropertiesImpl(java.lang.String... propertyNameValuePairs)
Convenience constructor for use in unit testing to instantiate a ready to use instance.- Parameters:
propertyNameValuePairs
- Property name/value pairs.
-
-
Method Detail
-
addProperty
public void addProperty(java.lang.String name, java.lang.String value)
Adds a property.- Parameters:
name
- Name of the property.value
- Value for the property.
-
getPropertyNames
public java.lang.String[] getPropertyNames()
Description copied from interface:SourceProperties
Obtains the names of the available properties in the order they were defined. This allows for ability to provide variable number of properties identified by a naming convention and being able to maintain their order.
An example would be providing a listing of routing configurations, each entry named
route.[something]
and order indicating priority.- Specified by:
getPropertyNames
in interfaceSourceProperties
- Returns:
- Names of the properties in the order defined.
-
getProperty
public java.lang.String getProperty(java.lang.String name) throws UnknownPropertyError
Description copied from interface:SourceProperties
Obtains a required property value.- Specified by:
getProperty
in interfaceSourceProperties
- Parameters:
name
- Name of the property.- Returns:
- Value of the property.
- Throws:
UnknownPropertyError
- If property was not configured. Let this propagate as OfficeFloor will handle it.
-
getProperty
public java.lang.String getProperty(java.lang.String name, java.lang.String defaultValue)
Description copied from interface:SourceProperties
Obtains the property value or subsequently the default value.- Specified by:
getProperty
in interfaceSourceProperties
- Parameters:
name
- Name of the property.defaultValue
- Default value if property not specified.- Returns:
- Value of the property or the the default value if not specified.
-
getProperties
public java.util.Properties getProperties()
Description copied from interface:SourceProperties
Properties to configure the source.- Specified by:
getProperties
in interfaceSourceProperties
- Returns:
- Properties specific for the source.
-
-