public class PropertiesFactory extends Object implements IPropertiesFactory
IPropertiesFactory
which uses the
IResourceStreamLocator
as defined by
ResourceSettings.getResourceStreamLocator()
to load the Properties
objects. Depending on the settings, it will assign
ModificationWatcher
s to the loaded resources to support reloading.ResourceSettings.getPropertiesFactory()
Constructor and Description |
---|
PropertiesFactory(IPropertiesFactoryContext context)
Construct.
|
Modifier and Type | Method and Description |
---|---|
void |
addListener(IPropertiesChangeListener listener)
Add a listener which will be called when a change to the underlying resource stream (e.g.
|
protected void |
addToWatcher(String path,
IResourceStream resourceStream,
IModificationWatcher watcher)
Add the resource stream to the file being watched
|
void |
clearCache()
Remove all cached properties.
|
protected Map<String,Properties> |
getCache()
For subclasses to get access to the cache
|
List<IPropertiesLoader> |
getPropertiesLoaders()
Gets the
List of properties loader. |
Properties |
load(Class<?> clazz,
String path)
Load the properties associated with the path
|
protected ValueMap |
loadFromLoader(IPropertiesLoader loader,
IResourceStream resourceStream) |
protected Map<String,Properties> |
newPropertiesCache() |
public PropertiesFactory(IPropertiesFactoryContext context)
context
- context for properties factorypublic List<IPropertiesLoader> getPropertiesLoaders()
List
of properties loader. You may add or remove properties loaders at your
will.List
of properties loaderprotected Map<String,Properties> newPropertiesCache()
public void addListener(IPropertiesChangeListener listener)
IPropertiesFactory
addListener
in interface IPropertiesFactory
IPropertiesFactory.addListener(org.apache.wicket.resource.IPropertiesChangeListener)
public final void clearCache()
IPropertiesFactory
clearCache
in interface IPropertiesFactory
IPropertiesFactory.clearCache()
public Properties load(Class<?> clazz, String path)
IPropertiesFactory
load
in interface IPropertiesFactory
clazz
- The class requesting the propertiespath
- The path to identify the resourceIPropertiesFactory.load(java.lang.Class, java.lang.String)
protected ValueMap loadFromLoader(IPropertiesLoader loader, IResourceStream resourceStream)
loader
- resourceStream
- protected void addToWatcher(String path, IResourceStream resourceStream, IModificationWatcher watcher)
path
- resourceStream
- watcher
- protected final Map<String,Properties> getCache()
Copyright © 2006–2022 Apache Software Foundation. All rights reserved.