|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object de.smartics.properties.spi.config.support.InMemoryPropertiesManager
@ThreadSafe public final class InMemoryPropertiesManager
Helper implementation to deal with property management. This is a pure String
key and value implementation of a properties map.
Constructor Summary | |
---|---|
InMemoryPropertiesManager(ConfigurationKey<?> configurationKey) Convenience constructor creating a UUID as source. |
|
InMemoryPropertiesManager(ConfigurationKey<?> configurationKey, PropertyLocation sourceId) Default constructor. |
Method Summary | |
---|---|
void |
addPropertyChangeListener(PropertyChangeListener listener) Adds the given listener to track any property changes. |
void |
addPropertyChangeListener(String name, PropertyChangeListener listener) Adds the given listener as a listener to the given property. |
boolean |
containsKey(String name) Checks if a given property is provided by the property provider. |
ConfigurationKey<?> |
getConfigurationKey() Returns the key of the configuration whose properties are managed. |
PropertyCollection |
getProperties() Returns the collection of all property values known to the system. |
Property |
getProperty(String name) Returns the property with the given name . |
PropertyLocation |
getSourceId() Returns the unique identifier of the property source. |
boolean |
isLazy() Providers that do not have to fetch their property definitions eagerly return true here. |
Property |
removeProperty(String name) Removes a property making it unknown to the system. |
void |
removePropertyChangeListener(PropertyChangeListener listener) Removes the given listener to stop tracking property changes. |
void |
removePropertyChangeListener(String name, PropertyChangeListener listener) Removes the given listener as a listener to the given property. |
Property |
setProperty(Property property) Sets the property with the given name to the given value . |
String |
toString() Returns the string representation of the object. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public InMemoryPropertiesManager(ConfigurationKey<?> configurationKey, PropertyLocation sourceId) throws NullPointerException
configurationKey
- the key of the configuration whose properties are managed.
sourceId
- the unique identifier of the property source.
NullPointerException
- if
configurationKey
or
sourceId
is
null
.
public InMemoryPropertiesManager(ConfigurationKey<?> configurationKey) throws NullPointerException
Usually the default constructor
should be used, since it provides proper information on the physical resource of the properties that is of invaluable help if someone tries to track down a configuration problem with a property.
configurationKey
- the key of the configuration whose properties are managed.
NullPointerException
- if
configurationKey
is
null
.
Method Detail |
---|
public ConfigurationKey<?> getConfigurationKey()
getConfigurationKey
in interface
PropertyProvider
public PropertyLocation getSourceId()
PropertyProvider
getSourceId
in interface
PropertyProvider
public boolean isLazy()
PropertyProvider
true
here. All others return
false
. Usually providers that fetch properties from a backend store are lazy, while properties on a class path are eager.
Generally: If the provider cannot fetch individual properties easily, then they should fetch them eagerly and hold them in memory. Otherwise they will fetch properties on demand (aka lazily).
isLazy
in interface
PropertyProvider
true
if the property provider is lazy,
false
if it is eager.
@CheckForNull public Property setProperty(Property property) throws NullPointerException
PropertySource
name
to the given
value
.
setProperty
in interface
PropertySource
property
- the property to be set.
null
if it either was not set or had the value
null
.
NullPointerException
- if
property
is
null
.
@CheckForNull public Property getProperty(String name) throws NullPointerException, IllegalArgumentException
PropertyProvider
name
.
getProperty
in interface
PropertyProvider
name
- the name of the property to fetch.
NullPointerException
- if
name
is
null
.
IllegalArgumentException
- if the property is not known. A property is not known if its key has not been registered. A property that is registered with the
null
value is known.
public boolean containsKey(String name) throws NullPointerException
PropertyProvider
containsKey
in interface
PropertyProvider
name
- the property name to check.
true
if the provider provides a property for the name,
false
otherwise.
NullPointerException
- if
name
is
null
.
@CheckForNull public Property removeProperty(String name) throws NullPointerException
PropertySource
null
use
PropertySource.setProperty(Property)
.
removeProperty
in interface
PropertySource
name
- the name of the property to be removed.
NullPointerException
- if
name
is
null
.
public PropertyCollection getProperties()
PropertyProvider
getProperties
in interface
PropertyProvider
null
.
public void addPropertyChangeListener(String name, PropertyChangeListener listener) throws NullPointerException
PropertyManager
addPropertyChangeListener
in interface
PropertyManager
name
- the name of the property to track changes.
listener
- the listener to add.
NullPointerException
- if
name
or
listener
is
null
.
public void removePropertyChangeListener(String name, PropertyChangeListener listener) throws NullPointerException
PropertyManager
removePropertyChangeListener
in interface
PropertyManager
name
- the name of the property to stop tracking changes.
listener
- the listener to remove.
NullPointerException
- if
name
or
listener
is
null
.
public void addPropertyChangeListener(PropertyChangeListener listener) throws NullPointerException
PropertyManager
addPropertyChangeListener
in interface
PropertyManager
listener
- the listener to add.
NullPointerException
- if
listener
is
null
.
public void removePropertyChangeListener(PropertyChangeListener listener) throws NullPointerException
PropertyManager
removePropertyChangeListener
in interface
PropertyManager
listener
- the listener to remove.
NullPointerException
- if
listener
is
null
.
public String toString()
toString
in class
Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |