Class PropertyListImpl
- java.lang.Object
-
- net.officefloor.compile.impl.properties.PropertyListImpl
-
- All Implemented Interfaces:
java.lang.Iterable<Property>
,PropertyList
public class PropertyListImpl extends java.lang.Object implements PropertyList
Implementation of thePropertyList
.- Author:
- Daniel Sagenschneider
-
-
Constructor Summary
Constructors Constructor Description PropertyListImpl(java.lang.String... nameValuePairs)
Initiate.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Property
addProperty(java.lang.String name)
Appends aProperty
to thisPropertyList
.Property
addProperty(java.lang.String name, java.lang.String label)
Appends aProperty
to thisPropertyList
.void
clear()
Clears thePropertyList
.void
configureProperties(PropertyConfigurable configurable)
Property
getOrAddProperty(java.lang.String name)
java.util.Properties
getProperties()
Obtains theProperties
populated with theProperty
values.Property
getProperty(java.lang.String name)
Obtains the firstProperty
by the input name.java.lang.String[]
getPropertyNames()
Obtains the names of theProperty
instances in the order they were added.java.lang.String
getPropertyValue(java.lang.String name, java.lang.String defaultValue)
Convenience method to obtain theProperty
value.java.util.Iterator<Property>
iterator()
void
normalise()
Normalises theProperty
instances.void
removeProperty(Property property)
Removes theProperty
from thisPropertyList
.void
sort(java.util.Comparator<? super Property> comparator)
Enable sorting theProperty
instances within thisPropertyList
.
-
-
-
Constructor Detail
-
PropertyListImpl
public PropertyListImpl(java.lang.String... nameValuePairs)
Initiate.- Parameters:
nameValuePairs
-Property
name/values to initially populate this list.
-
-
Method Detail
-
iterator
public java.util.Iterator<Property> iterator()
- Specified by:
iterator
in interfacejava.lang.Iterable<Property>
-
addProperty
public Property addProperty(java.lang.String name, java.lang.String label)
Description copied from interface:PropertyList
Appends aProperty
to thisPropertyList
.- Specified by:
addProperty
in interfacePropertyList
- Parameters:
name
- Name of theProperty
.label
- Label of theProperty
. Should this be blank it will be defaulted to the name.- Returns:
Property
added.
-
addProperty
public Property addProperty(java.lang.String name)
Description copied from interface:PropertyList
Appends aProperty
to thisPropertyList
.- Specified by:
addProperty
in interfacePropertyList
- Parameters:
name
- Name of theProperty
which is also used as the label.- Returns:
Property
added.
-
removeProperty
public void removeProperty(Property property)
Description copied from interface:PropertyList
Removes theProperty
from thisPropertyList
.- Specified by:
removeProperty
in interfacePropertyList
- Parameters:
property
-Property
to be removed.
-
getPropertyNames
public java.lang.String[] getPropertyNames()
Description copied from interface:PropertyList
Obtains the names of theProperty
instances in the order they were added.- Specified by:
getPropertyNames
in interfacePropertyList
- Returns:
- Names of the
Property
instances.
-
getProperty
public Property getProperty(java.lang.String name)
Description copied from interface:PropertyList
Obtains the firstProperty
by the input name.- Specified by:
getProperty
in interfacePropertyList
- Parameters:
name
- Name of theProperty
to return.- Returns:
- First
Property
by the input name, ornull
if noProperty
by the name.
-
getOrAddProperty
public Property getOrAddProperty(java.lang.String name)
Description copied from interface:PropertyList
- Specified by:
getOrAddProperty
in interfacePropertyList
- Parameters:
name
- Name of theProperty
to return.- Returns:
- First
Property
by the input name or a newly addedProperty
if noProperty
found by the name.
-
getPropertyValue
public java.lang.String getPropertyValue(java.lang.String name, java.lang.String defaultValue)
Description copied from interface:PropertyList
Convenience method to obtain theProperty
value.- Specified by:
getPropertyValue
in interfacePropertyList
- Parameters:
name
- Name of theProperty
to obtain its value.defaultValue
- Default value should theProperty
not exist or have blank value.- Returns:
- Value for the
Property
(ordefaultValue
if not available).
-
getProperties
public java.util.Properties getProperties()
Description copied from interface:PropertyList
Obtains theProperties
populated with theProperty
values.- Specified by:
getProperties
in interfacePropertyList
- Returns:
- Populated
Properties
.
-
clear
public void clear()
Description copied from interface:PropertyList
Clears thePropertyList
.- Specified by:
clear
in interfacePropertyList
-
sort
public void sort(java.util.Comparator<? super Property> comparator)
Description copied from interface:PropertyList
Enable sorting theProperty
instances within thisPropertyList
.- Specified by:
sort
in interfacePropertyList
- Parameters:
comparator
-Comparator
to provide comparisons for sorting.
-
normalise
public void normalise()
Description copied from interface:PropertyList
Normalises the
Property
instances.This will remove:
- Specified by:
normalise
in interfacePropertyList
-
configureProperties
public void configureProperties(PropertyConfigurable configurable)
Description copied from interface:PropertyList
- Specified by:
configureProperties
in interfacePropertyList
- Parameters:
configurable
-PropertyConfigurable
to be configured with theProperty
values.
-
-