Class ResourceBundleModel

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.Object exec​(java.util.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.
      java.lang.String format​(java.lang.String key, java.lang.Object[] params)
      Provides direct access to caching format engine from code (instead of from script).
      java.util.ResourceBundle getBundle()  
      protected TemplateModel invokeGenericGet​(java.util.Map keyMap, java.lang.Class clazz, java.lang.String key)
      Overridden to invoke the getObject method of the resource bundle.
      boolean isEmpty()
      Returns true if this bundle contains no objects.
      protected java.util.Set keySet()
      Helper method to support TemplateHashModelEx.
      int size()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • ResourceBundleModel

        public ResourceBundleModel​(java.util.ResourceBundle bundle,
                                   BeansWrapper wrapper)
    • Method Detail

      • keySet

        protected java.util.Set keySet()
        Description copied from class: BeanModel
        Helper method to support TemplateHashModelEx. Returns the Set of Strings which are available via the TemplateHashModel interface. Subclasses that override invokeGenericGet to provide additional hash keys should also override this method.
        Overrides:
        keySet in class BeanModel
      • exec

        public java.lang.Object exec​(java.util.List arguments)
                              throws TemplateModelException
        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.
        Specified by:
        exec in interface TemplateMethodModel
        Specified by:
        exec in interface TemplateMethodModelEx
        Parameters:
        arguments - a List of TemplateModel-s, containing the arguments passed to the method. If the implementation absolutely wants to operate on POJOs, it can use the static utility methods in the DeepUnwrap class to easily obtain them. However, unwrapping is not always possible (or not perfectly), and isn't always efficient, so it's recommended to use the original TemplateModel value as much as possible.
        Returns:
        the return value of the method, or null. If the returned value does not implement TemplateModel, it will be automatically wrapped using the environment's object wrapper.
        Throws:
        TemplateModelException
      • format

        public java.lang.String format​(java.lang.String key,
                                       java.lang.Object[] params)
                                throws java.util.MissingResourceException
        Provides direct access to caching format engine from code (instead of from script).
        Throws:
        java.util.MissingResourceException
      • getBundle

        public java.util.ResourceBundle getBundle()