Package adams.core
Class PropertiesBasedEnumeration<T extends ConfigurableEnumeration.AbstractItem>
- java.lang.Object
-
- adams.core.ConfigurableEnumeration<T>
-
- adams.core.PropertiesBasedEnumeration<T>
-
- All Implemented Interfaces:
Serializable
,Iterable<T>
public abstract class PropertiesBasedEnumeration<T extends ConfigurableEnumeration.AbstractItem> extends ConfigurableEnumeration<T>
Enumeration that uses properties as backend.- Author:
- FracPete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class adams.core.ConfigurableEnumeration
ConfigurableEnumeration.AbstractItem<E extends ConfigurableEnumeration>
-
-
Field Summary
Fields Modifier and Type Field Description static String
KEY_ITEMS
the key for listing all the items.protected Properties
m_Properties
the properties to use.static String
SUFFIX_DISPLAY
the key suffix for the display text.static String
SUFFIX_ID
the key suffix for the ID.-
Fields inherited from class adams.core.ConfigurableEnumeration
m_Items
-
-
Constructor Summary
Constructors Constructor Description PropertiesBasedEnumeration()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected Properties
getProperties()
Returns the properties.protected T[]
initialize()
Initializes the items.protected T
postProcess(T item, Properties props, String key)
For post-processing an item.protected abstract Properties
readProperties()
Reads the properties from disk.-
Methods inherited from class adams.core.ConfigurableEnumeration
check, iterator, newItem, parse, toString, values
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Field Detail
-
KEY_ITEMS
public static final String KEY_ITEMS
the key for listing all the items.- See Also:
- Constant Field Values
-
SUFFIX_ID
public static final String SUFFIX_ID
the key suffix for the ID.- See Also:
- Constant Field Values
-
SUFFIX_DISPLAY
public static final String SUFFIX_DISPLAY
the key suffix for the display text.- See Also:
- Constant Field Values
-
m_Properties
protected Properties m_Properties
the properties to use.
-
-
Method Detail
-
initialize
protected T[] initialize()
Initializes the items.- Specified by:
initialize
in classConfigurableEnumeration<T extends ConfigurableEnumeration.AbstractItem>
- Returns:
- the items
-
postProcess
protected T postProcess(T item, Properties props, String key)
For post-processing an item. E.g., adding additional information.- Parameters:
item
- the new itemprops
- the underlying propertieskey
- the current key in the properties- Returns:
- the updated item
-
getProperties
protected Properties getProperties()
Returns the properties.- Returns:
- the properties
-
readProperties
protected abstract Properties readProperties()
Reads the properties from disk.- Returns:
- the properties
-
-