public class Configuration
extends java.util.Properties
Properties
and can neither
be removed nor get a lower visibility modificator.Constructor and Description |
---|
Configuration()
Creates a new (empty) configuration.
|
Configuration(java.util.Properties defaults)
Creates a new instance of this class using the given parameters.
|
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
convertToPath(java.lang.String pathname)
Based upon Guava 14.0.1 (Chris Nokleberg, Colin Decker).
|
Configuration |
flatten()
Flattens the Properties hierarchies and returns a new Configuration object.
|
Configuration |
flatten(Configuration defaultConfiguration)
Flattens the Properties hierarchies and returns a new Configuration object.
|
void |
flattenInPlace()
Flattens the Properties hierarchies with this Configuration.
|
java.lang.Object |
get(java.lang.Object key)
Deprecated.
This method will not be removed (as this is for technical reasons not possible), but should only be used within this class. Don't call this method
directly.
|
boolean |
getBooleanProperty(java.lang.String key)
Reads the given property from the configuration and interprets it as a boolean.
|
boolean |
getBooleanProperty(java.lang.String key,
boolean defaultValue)
Reads the given property from the configuration and interprets it as a boolean.
|
double |
getDoubleProperty(java.lang.String key)
Reads the given property from the configuration and interprets it as a double.
|
double |
getDoubleProperty(java.lang.String key,
double defaultValue)
Reads the given property from the configuration and interprets it as a double.
|
int |
getIntProperty(java.lang.String key)
Reads the given property from the configuration and interprets it as an integer.
|
int |
getIntProperty(java.lang.String key,
int defaultValue)
Reads the given property from the configuration and interprets it as an integer.
|
long |
getLongProperty(java.lang.String key)
Reads the given property from the configuration and interprets it as a long.
|
long |
getLongProperty(java.lang.String key,
long defaultValue)
Reads the given property from the configuration and interprets it as a long.
|
java.lang.String |
getPathProperty(java.lang.String key)
Reads the given property from the configuration and interprets it as a path.
|
Configuration |
getPropertiesStartingWith(java.lang.String prefix)
Flattens the Properties hierarchies and returns a Configuration object containing only keys starting with the prefix.
|
java.lang.String |
getProperty(java.lang.String key)
Deprecated.
This method will not be removed (as this is for technical reasons not possible), but should only be used within this class. Don't call this method
directly.
|
java.lang.String |
getProperty(java.lang.String key,
java.lang.String defaultValue)
Deprecated.
This method will not be removed (as this is for technical reasons not possible), but should only be used within this class. Don't call this method
directly.
|
java.lang.String[] |
getStringArrayProperty(java.lang.String key)
Interprets the property (defined by the given key) as an array of values and transforms it into a real array.
|
java.lang.String[] |
getStringArrayProperty(java.lang.String key,
java.lang.String split)
Interprets the property (defined by the given key) as an array of values and transforms it into a real array.
|
java.lang.String |
getStringProperty(java.lang.String key)
Reads the given property from the configuration and interprets it as a string.
|
java.lang.String |
getStringProperty(java.lang.String key,
java.lang.String defaultValue)
Reads the given property from the configuration and interprets it as a string.
|
java.lang.Object |
put(java.lang.Object key,
java.lang.Object value)
Deprecated.
This method will not be removed (as this is for technical reasons not possible), but should only be used within this class. Don't call this method
directly.
|
void |
setDefaultConfiguration(Configuration defaultConfiguration)
You should know what you do if you use this method!
Currently it is used for a (dirty) hack to add default configurations to Writers or AnalysisPlugins.
|
void |
setProperty(java.lang.String key,
boolean value)
Convenience method to set boolean-valued properties.
|
void |
setProperty(java.lang.String key,
double value)
Convenience method to set double-valued properties.
|
void |
setProperty(java.lang.String key,
int value)
Convenience method to set int-valued properties.
|
void |
setProperty(java.lang.String key,
long value)
Convenience method to set long-valued properties.
|
void |
setStringArrayProperty(java.lang.String key,
java.lang.String[] value)
Sets a property to the given string array.
|
static java.lang.String |
toProperty(java.lang.Object[] values)
Converts the Object[] to a String split by '|'.
|
list, list, load, load, loadFromXML, propertyNames, save, setProperty, store, store, storeToXML, storeToXML, stringPropertyNames
public Configuration()
public Configuration(java.util.Properties defaults)
defaults
- The property object which delivers the default values for the new configuration.public final java.lang.String getStringProperty(java.lang.String key)
key
- The key of the property.public final java.lang.String getStringProperty(java.lang.String key, java.lang.String defaultValue)
key
- The key of the property.defaultValue
- The default value for the given key
defaultValue
, if the property does not exist.public final boolean getBooleanProperty(java.lang.String key)
key
- The key of the property.public final boolean getBooleanProperty(java.lang.String key, boolean defaultValue)
key
- The key of the property.defaultValue
- The default value for this propertypublic void setProperty(java.lang.String key, boolean value)
key
- The key to be placed in this configurationvalue
- The value to be stored for the given keypublic final int getIntProperty(java.lang.String key)
key
- The key of the property.public final int getIntProperty(java.lang.String key, int defaultValue)
key
- The key of the property.defaultValue
- The default value for this propertypublic void setProperty(java.lang.String key, int value)
key
- The key to be placed in this configurationvalue
- The value to be stored for the given keypublic final long getLongProperty(java.lang.String key)
key
- The key of the property.public final long getLongProperty(java.lang.String key, long defaultValue)
key
- The key of the property.defaultValue
- The default value for this propertypublic void setProperty(java.lang.String key, long value)
key
- The key to be placed in this configurationvalue
- The value to be stored for the given keypublic final double getDoubleProperty(java.lang.String key)
key
- The key of the property.public final double getDoubleProperty(java.lang.String key, double defaultValue)
key
- The key of the property.defaultValue
- The default value for this propertypublic void setProperty(java.lang.String key, double value)
key
- The key to be placed in this configurationvalue
- The value to be stored for the given keypublic final java.lang.String getPathProperty(java.lang.String key)
key
- The key of the property.public final java.lang.String[] getStringArrayProperty(java.lang.String key)
key
- The key of the property.public void setStringArrayProperty(java.lang.String key, java.lang.String[] value)
key
- The key of the property to changevalue
- The array to setpublic final java.lang.String[] getStringArrayProperty(java.lang.String key, java.lang.String split)
split
- a regular expressionkey
- The key of the property.toProperty(Object[])
public static final java.lang.String toProperty(java.lang.Object[] values)
values
- The values which will be transformed into a string.getStringArrayProperty(String)
,
getStringArrayProperty(String, String)
public static final java.lang.String convertToPath(java.lang.String pathname)
pathname
- The path to be simplified.public final Configuration getPropertiesStartingWith(java.lang.String prefix)
prefix
- The prefix to be used during the flattening.public final Configuration flatten(Configuration defaultConfiguration)
defaultConfiguration
- The configuration which will be used as a base.public final Configuration flatten()
public final void flattenInPlace()
public void setDefaultConfiguration(Configuration defaultConfiguration)
defaultConfiguration
- The default configuration for this configuration object.@Deprecated public final java.lang.Object put(java.lang.Object key, java.lang.Object value)
Properties.setProperty(String, String)
instead!put
in interface java.util.Map<java.lang.Object,java.lang.Object>
put
in class java.util.Hashtable<java.lang.Object,java.lang.Object>
key
- The key which will be used to store the given value.value
- The value to store.@Deprecated public final java.lang.Object get(java.lang.Object key)
getStringProperty(String)
instead!get
in interface java.util.Map<java.lang.Object,java.lang.Object>
get
in class java.util.Hashtable<java.lang.Object,java.lang.Object>
key
- The key for the value in question.@Deprecated public final java.lang.String getProperty(java.lang.String key)
getStringProperty(String)
instead!getProperty
in class java.util.Properties
key
- The key for the property in question.@Deprecated public final java.lang.String getProperty(java.lang.String key, java.lang.String defaultValue)
getProperty
in class java.util.Properties
key
- The key for the property in question.defaultValue
- The default value to be returned.Copyright 2017 Kieker Project, http://kieker-monitoring.net