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 Object implements SourceProperties
SourceProperties implementation.
Author:
Daniel Sagenschneider
  • Constructor Details

    • SourcePropertiesImpl

      public SourcePropertiesImpl()
      Initiate empty property list.
    • SourcePropertiesImpl

      public SourcePropertiesImpl(SourceProperties sourceProperties)
      Initiate to contain the input SourceProperties.
      Parameters:
      sourceProperties - SourceProperties.
    • SourcePropertiesImpl

      public SourcePropertiesImpl(String... propertyNameValuePairs)
      Convenience constructor for use in unit testing to instantiate a ready to use instance.
      Parameters:
      propertyNameValuePairs - Property name/value pairs.
  • Method Details

    • addProperty

      public void addProperty(String name, String value)
      Adds a property.
      Parameters:
      name - Name of the property.
      value - Value for the property.
    • getPropertyNames

      public 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 interface SourceProperties
      Returns:
      Names of the properties in the order defined.
    • getProperty

      public String getProperty(String name) throws UnknownPropertyError
      Description copied from interface: SourceProperties
      Obtains a required property value.
      Specified by:
      getProperty in interface SourceProperties
      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 String getProperty(String name, String defaultValue)
      Description copied from interface: SourceProperties
      Obtains the property value or subsequently the default value.
      Specified by:
      getProperty in interface SourceProperties
      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 Properties getProperties()
      Description copied from interface: SourceProperties
      Properties to configure the source.
      Specified by:
      getProperties in interface SourceProperties
      Returns:
      Properties specific for the source.