public class ConfigurationEntry
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static class |
ConfigurationEntry.Type
Defines the supported types of configuration entries.
|
| Modifier and Type | Field and Description |
|---|---|
private java.lang.Class<?> |
elemType
Stores additional information characterizing
type. |
private static HashMap<java.lang.String,ConfigurationEntry> |
ENTRIES
Stores the configuration entries.
|
private java.lang.reflect.Field |
field
Stores the field representing the attribute of this configuration entry.
|
private java.lang.String |
name
Stores the name of the entry.
|
private ConfigurationEntry.Type |
type
Stores the type of this configuration entry.
|
| Modifier | Constructor and Description |
|---|---|
private |
ConfigurationEntry(java.lang.String name,
java.lang.String fieldName,
ConfigurationEntry.Type type,
java.lang.Class<?> elemType)
Creates a new configuration entry.
|
| Modifier and Type | Method and Description |
|---|---|
static java.util.Iterator<ConfigurationEntry> |
getEntries()
Returns all registered configuration entries.
|
static ConfigurationEntry |
getEntry(java.lang.String name)
Returns the entry matching the given
name. |
java.lang.String |
getName()
Returns the name of this entry.
|
private static java.lang.Object |
getPrimitiveValue(java.lang.String value,
ConfigurationEntry.Type type,
java.lang.Class<?> elemType)
Converts the given string to the given type (in case that the
type is primitive) and returns the converted object result.
|
static void |
registerEntry(java.lang.String name,
ConfigurationEntry.Type type)
Registers a new configuration entry.
|
static void |
registerEntry(java.lang.String name,
java.lang.String fieldName,
ConfigurationEntry.Type type)
Registers a new configuration entry.
|
static void |
registerEntry(java.lang.String name,
java.lang.String fieldName,
ConfigurationEntry.Type type,
java.lang.Class<?> elemType)
Registers a new configuration entry.
|
void |
setValue(java.lang.String value)
Converts the given string to the type of this entry and applies it to
the configuration instance.
|
private static final HashMap<java.lang.String,ConfigurationEntry> ENTRIES
private ConfigurationEntry.Type type
private java.lang.reflect.Field field
private java.lang.String name
private java.lang.Class<?> elemType
type.private ConfigurationEntry(java.lang.String name,
java.lang.String fieldName,
ConfigurationEntry.Type type,
java.lang.Class<?> elemType)
name - the name of the entryfieldName - the name of the field where to store the value totype - the type of the entryelemType - additional type information when type
is ConfigurationEntry.Type.ENUM or ConfigurationEntry.Type.ARRAY_ENUMjava.lang.IllegalArgumentException - in case that name is
null, type is null or that the related
attribute in the configuration does not exist.public static final void registerEntry(java.lang.String name,
java.lang.String fieldName,
ConfigurationEntry.Type type,
java.lang.Class<?> elemType)
name - the name of the entryfieldName - the name of the field where to store the value totype - the type of the entryelemType - additional type information when type
is ConfigurationEntry.Type.ENUM or ConfigurationEntry.Type.ARRAY_ENUMjava.lang.IllegalArgumentException - in case that name is
null, type is null or that the related
attribute in the configuration does not exist.public static final void registerEntry(java.lang.String name,
java.lang.String fieldName,
ConfigurationEntry.Type type)
name - the name of the entryfieldName - the name of the field where to store the value totype - the type of the entryjava.lang.IllegalArgumentException - in case that name is
null, type is null or that the related
attribute in the configuration does not exist.public static final void registerEntry(java.lang.String name,
ConfigurationEntry.Type type)
name - the name of the entry (also the name of the field)type - the type of the entryjava.lang.IllegalArgumentException - in case that name is
null, type is null or that the related
attribute in the configuration does not exist.public static final ConfigurationEntry getEntry(java.lang.String name)
name.name - the name of the profile to be returnedjava.lang.IllegalArgumentException - if name is nullpublic static final java.util.Iterator<ConfigurationEntry> getEntries()
public java.lang.String getName()
public void setValue(java.lang.String value)
value - the value to be set for this entryjava.lang.IllegalArgumentException - in case that the value
cannot be set for some reason (e.g. cannot be converted to target
type)private static java.lang.Object getPrimitiveValue(java.lang.String value,
ConfigurationEntry.Type type,
java.lang.Class<?> elemType)
value - the value to be set for this entrytype - the type to convert forelemType - the additional information characterizing e.g. enums