wicket.resource
Class PropertiesFactory

java.lang.Object
  extended by wicket.resource.PropertiesFactory
All Implemented Interfaces:
IPropertiesFactory

public class PropertiesFactory
extends java.lang.Object
implements IPropertiesFactory

Reloadable properties. It is not a 100% replacement for java.util.Properties as it does not provide the same interface. But is serves kind of the same purpose with Wicket specific features. PropertiesFactory actually loads and reloads the Properties and mataince a cache. Hence properties files are loaded just once.

Author:
Juergen Donnerstag
See Also:
IResourceSettings.getPropertiesFactory()

Constructor Summary
PropertiesFactory()
          Construct.
 
Method Summary
 void addListener(IPropertiesReloadListener listener)
          Add a listener which will be called after properties have been reloaded
 void clearCache()
          Remove all cached properties
 java.lang.String createResourceKey(java.lang.Class componentClass, java.util.Locale locale, java.lang.String style)
          Create a unique key to identify the properties file in the cache
 Properties get(Application application, java.lang.Class clazz, java.lang.String style, java.util.Locale locale)
          Get the properties for ...
protected  java.util.Map getCache()
          For subclasses to get access to the cache
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PropertiesFactory

public PropertiesFactory()
Construct.

Method Detail

addListener

public void addListener(IPropertiesReloadListener listener)
Description copied from interface: IPropertiesFactory
Add a listener which will be called after properties have been reloaded

Specified by:
addListener in interface IPropertiesFactory
See Also:
IPropertiesFactory.addListener(wicket.resource.IPropertiesReloadListener)

get

public Properties get(Application application,
                      java.lang.Class clazz,
                      java.lang.String style,
                      java.util.Locale locale)
Description copied from interface: IPropertiesFactory
Get the properties for ...

Specified by:
get in interface IPropertiesFactory
Parameters:
application - The application object
clazz - The class that resources are bring loaded for
style - The style to load resources for (see Session)
locale - The locale to load reosurces for
Returns:
The properties
See Also:
IPropertiesFactory.get(wicket.Application, java.lang.Class, java.lang.String, java.util.Locale)

getCache

protected final java.util.Map getCache()
For subclasses to get access to the cache

Returns:
Map

clearCache

public final void clearCache()
Description copied from interface: IPropertiesFactory
Remove all cached properties

Specified by:
clearCache in interface IPropertiesFactory
See Also:
IPropertiesFactory.clearCache()

createResourceKey

public final java.lang.String createResourceKey(java.lang.Class componentClass,
                                                java.util.Locale locale,
                                                java.lang.String style)
Create a unique key to identify the properties file in the cache

Parameters:
componentClass - The class that resources are bring loaded for
locale - The locale to load reosurces for
style - The style to load resources for (see Session)
Returns:
The resource key


Copyright © 2004-2007 Wicket developers. All Rights Reserved.