Class SourcePropertiesImpl
java.lang.Object
net.officefloor.frame.impl.construct.source.SourcePropertiesImpl
- All Implemented Interfaces:
SourceProperties
- Direct Known Subclasses:
PropertyListSourceProperties,SourceContextImpl
SourceProperties implementation.- Author:
- Daniel Sagenschneider
-
Constructor Summary
ConstructorsConstructorDescriptionInitiate empty property list.SourcePropertiesImpl(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
Modifier and TypeMethodDescriptionvoidaddProperty(String name, String value) Adds a property.Properties to configure the source.getProperty(String name) Obtains a required property value.getProperty(String name, String defaultValue) Obtains the property value or subsequently the default value.String[]Obtains the names of the available properties in the order they were defined.
-
Constructor Details
-
SourcePropertiesImpl
public SourcePropertiesImpl()Initiate empty property list. -
SourcePropertiesImpl
Initiate to contain the inputSourceProperties.- Parameters:
sourceProperties-SourceProperties.
-
SourcePropertiesImpl
Convenience constructor for use in unit testing to instantiate a ready to use instance.- Parameters:
propertyNameValuePairs- Property name/value pairs.
-
-
Method Details
-
addProperty
Adds a property.- Parameters:
name- Name of the property.value- Value for the property.
-
getPropertyNames
Description copied from interface:SourcePropertiesObtains 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:
getPropertyNamesin interfaceSourceProperties- Returns:
- Names of the properties in the order defined.
-
getProperty
Description copied from interface:SourcePropertiesObtains a required property value.- Specified by:
getPropertyin 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
Description copied from interface:SourcePropertiesObtains the property value or subsequently the default value.- Specified by:
getPropertyin 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
Description copied from interface:SourcePropertiesProperties to configure the source.- Specified by:
getPropertiesin interfaceSourceProperties- Returns:
- Properties specific for the source.
-