Class SourcePropertiesImpl

    • 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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SourcePropertiesImpl

        public SourcePropertiesImpl()
        Initiate empty property list.
      • 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 interface SourceProperties
        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 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 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 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 java.util.Properties getProperties()
        Description copied from interface: SourceProperties
        Properties to configure the source.
        Specified by:
        getProperties in interface SourceProperties
        Returns:
        Properties specific for the source.