public interface Registry
| Modifier and Type | Method and Description |
|---|---|
void |
addChangeListener(RegistryListener listener)
Add a change listener.
|
void |
addConfigurationFromFile(File file)
Load configuration from the given file.
|
void |
addConfigurationFromFile(File file,
String prefix)
Load configuration from the given file.
|
void |
addConfigurationFromResource(String resource)
Load configuration from the given classloader resource.
|
void |
addConfigurationFromResource(String resource,
String prefix)
Load configuration from the given classloader resource.
|
String |
dump()
Dump the entire registry to a string, for debugging purposes.
|
boolean |
getBoolean(String key)
Get a boolean value from the registry.
|
boolean |
getBoolean(String key,
boolean defaultValue)
Get a boolean value from the registry.
|
Collection<String> |
getFullKeys()
Get all the keys in this registry.
|
int |
getInt(String key)
Get an integer value from the registry.
|
int |
getInt(String key,
int defaultValue)
Get an integer value from the registry.
|
Collection<String> |
getKeys()
Get all the keys in this registry.
|
List |
getList(String key)
Get a list of strings at the given key in the registry.
|
Properties |
getProperties(String key)
TODO move to Map which is more generic ?
|
Registry |
getSection(String name)
Get a subsection of the registry, identified by the given name.
|
String |
getString(String key)
Get a string value from the registry.
|
String |
getString(String key,
String defaultValue)
Get a string value from the registry.
|
Registry |
getSubset(String key)
Get a subset of the registry, for all keys descended from the given key.
|
List |
getSubsetList(String key)
Get a list of subsets of the registry, for all keys descended from the given key.
|
void |
initialize() |
boolean |
isEmpty()
Determine if the registry contains any elements.
|
void |
remove(String key)
Remove a keyed element from the registry.
|
boolean |
removeChangeListener(RegistryListener listener) |
void |
removeSubset(String key)
Remove a keyed subset of the registry.
|
void |
save()
Save any changes to the registry since it was loaded.
|
void |
setBoolean(String key,
boolean value)
Set a boolean value in the registry.
|
void |
setInt(String key,
int value)
Set an integer value in the registry.
|
void |
setString(String key,
String value)
Set a string value in the registry.
|
String dump()
String getString(String key)
null is returned.key - the key in the registryString getString(String key, String defaultValue)
key - the key in the registrydefaultValue - the default valuevoid setString(String key, String value)
key - the key in the registryvalue - the value to setint getInt(String key)
key - the key in the registryNoSuchElementException - if the key is not foundint getInt(String key, int defaultValue)
key - the key in the registrydefaultValue - the default valuevoid setInt(String key, int value)
key - the key in the registryvalue - the value to setboolean getBoolean(String key)
key - the key in the registryNoSuchElementException - if the key is not foundboolean getBoolean(String key, boolean defaultValue)
key - the key in the registrydefaultValue - the default valuevoid setBoolean(String key, boolean value)
key - the key in the registryvalue - the value to setvoid addConfigurationFromResource(String resource) throws RegistryException
resource - the location to load the configuration fromRegistryException - if a problem occurred reading the resource to add to the registryvoid addConfigurationFromResource(String resource, String prefix) throws RegistryException
resource - the location to load the configuration fromprefix - the location to add the configuration at in the registryRegistryException - if a problem occurred reading the resource to add to the registryvoid addConfigurationFromFile(File file) throws RegistryException
file - the location to load the configuration fromRegistryException - if a problem occurred reading the resource to add to the registryvoid addConfigurationFromFile(File file, String prefix) throws RegistryException
file - the location to load the configuration fromprefix - the location to add the configuration at in the registryRegistryException - if a problem occurred reading the resource to add to the registryboolean isEmpty()
List getList(String key)
key - the key to lookupProperties getProperties(String key)
key - the key to lookupRegistry getSubset(String key)
key - the key to take the subset fromList getSubsetList(String key)
key - the key to take the subsets fromRegistry getSection(String name)
null will be
returned.name - registry section namevoid save() throws RegistryException, UnsupportedOperationException
RegistryException - if there was a problem saving the registryUnsupportedOperationException - if the registry is not writablevoid addChangeListener(RegistryListener listener)
listener - the listenerboolean removeChangeListener(RegistryListener listener)
listener - true if has been removedCollection<String> getKeys()
Collection<String> getFullKeys()
void remove(String key)
key - the key to removevoid removeSubset(String key)
key - the subset to removevoid initialize() throws RegistryException
RegistryExceptionCopyright © 2006–2019 The Apache Software Foundation. All rights reserved.