net.officefloor.compile.properties
Interface PropertyList

All Superinterfaces:
Iterable<Property>
All Known Implementing Classes:
PropertyListImpl

public interface PropertyList
extends Iterable<Property>

Listing of Property instances.

Author:
Daniel Sagenschneider

Method Summary
 Property addProperty(String name)
          Appends a Property to this PropertyList.
 Property addProperty(String name, String label)
          Appends a Property to this PropertyList.
 void clear()
          Clears the PropertyList.
 Property getOrAddProperty(String name)
          Convenience method that attempts to get the Property and if not found adds the Property.
 Properties getProperties()
          Obtains the Properties populated with the Property values.
 Property getProperty(String name)
          Obtains the first Property by the input name.
 String[] getPropertyNames()
          Obtains the names of the Property instances in the order they were added.
 String getPropertyValue(String name, String defaultValue)
          Convenience method to obtain the Property value.
 void normalise()
           Normalises the Property instances.
 void removeProperty(Property property)
          Removes the Property from this PropertyList.
 void sort(Comparator<? super Property> comparator)
          Enable sorting the Property instances within this PropertyList.
 
Methods inherited from interface java.lang.Iterable
iterator
 

Method Detail

addProperty

Property addProperty(String name,
                     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.

addProperty

Property addProperty(String name)
Appends a Property to this PropertyList.

Parameters:
name - Name of the Property which is also used as the label.
Returns:
Property added.

removeProperty

void removeProperty(Property property)
Removes the Property from this PropertyList.

Parameters:
property - Property to be removed.

getPropertyNames

String[] getPropertyNames()
Obtains the names of the Property instances in the order they were added.

Returns:
Names of the Property instances.

getProperty

Property getProperty(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(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

String getPropertyValue(String name,
                        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

Properties getProperties()
Obtains the Properties populated with the Property values.

Returns:
Populated Properties.

clear

void clear()
Clears the PropertyList.


sort

void sort(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)



Copyright © 2005-2013. All Rights Reserved.