Interface PropertyList

  • All Superinterfaces:
    java.lang.Iterable<Property>
    All Known Implementing Classes:
    PropertyListImpl

    public interface PropertyList
    extends java.lang.Iterable<Property>
    Listing of Property instances.
    Author:
    Daniel Sagenschneider
    • Method Detail

      • addProperty

        Property addProperty​(java.lang.String name,
                             java.lang.String label)
        Appends a Property to this PropertyList.
        Parameters:
        name - Name of the Property.
        label - Label of the Property. Should this be blank it will be defaulted to the name.
        Returns:
        Property added.
      • getPropertyNames

        java.lang.String[] getPropertyNames()
        Obtains the names of the Property instances in the order they were added.
        Returns:
        Names of the Property instances.
      • getProperty

        Property getProperty​(java.lang.String name)
        Obtains the first Property by the input name.
        Parameters:
        name - Name of the Property to return.
        Returns:
        First Property by the input name, or null if no Property by the name.
      • getOrAddProperty

        Property getOrAddProperty​(java.lang.String name)
        Convenience method that attempts to get the Property and if not found adds the Property.
        Parameters:
        name - Name of the Property to return.
        Returns:
        First Property by the input name or a newly added Property if no Property found by the name.
      • getPropertyValue

        java.lang.String getPropertyValue​(java.lang.String name,
                                          java.lang.String defaultValue)
        Convenience method to obtain the Property value.
        Parameters:
        name - Name of the Property to obtain its value.
        defaultValue - Default value should the Property not exist or have blank value.
        Returns:
        Value for the Property (or defaultValue if not available).
      • getProperties

        java.util.Properties getProperties()
        Obtains the Properties populated with the Property values.
        Returns:
        Populated Properties.
      • sort

        void sort​(java.util.Comparator<? super Property> comparator)
        Enable sorting the Property instances within this PropertyList.
        Parameters:
        comparator - Comparator to provide comparisons for sorting.
      • normalise

        void normalise()

        Normalises the Property instances.

        This will remove:

        1. any Property with a blank name
        2. any Property with a blank value
        3. duplicate Property instances by the same name (keeps the first Property)