| java.lang.Object freemarker.ext.beans.BeanModel freemarker.ext.beans.ResourceBundleModel
ResourceBundleModel | public class ResourceBundleModel extends BeanModel implements TemplateMethodModelEx(Code) | | A hash model that wraps a resource bundle. Makes it convenient to store
localized content in the data model. It also acts as a method model that will
take a resource key and arbitrary number of arguments and will apply
MessageFormat with arguments on the string represented by the key.
Typical usages:
- bundle.resourceKey will retrieve the object from resource bundle
with key resourceKey
- bundle("patternKey", arg1, arg2, arg3) will retrieve the string
from resource bundle with key patternKey, and will use it as a pattern
for MessageFormat with arguments arg1, arg2 and arg3
author: Attila Szegedi version: $Id: ResourceBundleModel.java,v 1.22.2.2 2007/04/02 13:19:37 szegedia Exp $ |
Method Summary | |
public Object | exec(List arguments) Takes first argument as a resource key, looks up a string in resource bundle
with this key, then applies a MessageFormat.format on the string with the
rest of the arguments. | public String | format(String key, Object[] params) Provides direct access to caching format engine from code (instead of from script). | public ResourceBundle | getBundle() | protected TemplateModel | invokeGenericGet(Map keyMap, Class clazz, String key) Overridden to invoke the getObject method of the resource bundle. | public boolean | isEmpty() Returns true if this bundle contains no objects. | protected Set | keySet() | public int | size() |
exec | public Object exec(List arguments) throws TemplateModelException(Code) | | Takes first argument as a resource key, looks up a string in resource bundle
with this key, then applies a MessageFormat.format on the string with the
rest of the arguments. The created MessageFormats are cached for later reuse.
|
isEmpty | public boolean isEmpty()(Code) | | Returns true if this bundle contains no objects.
|
|
|