org.riotfamily.common.web.view.freemarker
Class LocalizedObjectWrapperPlugin

java.lang.Object
  extended by org.riotfamily.common.web.view.freemarker.LocalizedObjectWrapperPlugin
All Implemented Interfaces:
ObjectWrapperPlugin, Ordered

public class LocalizedObjectWrapperPlugin
extends Object
implements ObjectWrapperPlugin, Ordered

ObjectWrapperPlugin that supports Maps containing Locale keys. When the map is to be wrapped, the entry for the current locale is returned instead of the map itself.

Since:
6.5
Author:
Felix Gnass [fgnass at neteye dot de]

Field Summary
 
Fields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
 
Constructor Summary
LocalizedObjectWrapperPlugin()
           
 
Method Summary
 int getOrder()
           
 void setExact(boolean exact)
          Sets whether the current locale must exactly match the key.
 void setFallbackLocale(Locale fallbackLocale)
          Sets a fallback locale that is used in case no entry is found for the current locale.
 void setOrder(int order)
          Sets the order.
 boolean supports(Object obj)
           
 freemarker.template.TemplateModel wrapSupportedObject(Object obj, PluginObjectWrapper wrapper)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LocalizedObjectWrapperPlugin

public LocalizedObjectWrapperPlugin()
Method Detail

setExact

public void setExact(boolean exact)
Sets whether the current locale must exactly match the key. If set to false (which is the default), a second lookup is performed with the language only in case no entry can be found.


setFallbackLocale

public void setFallbackLocale(Locale fallbackLocale)
Sets a fallback locale that is used in case no entry is found for the current locale. Default is null.


getOrder

public int getOrder()
Specified by:
getOrder in interface Ordered

setOrder

public void setOrder(int order)
Sets the order. Default is Ordered.LOWEST_PRECEDENCE.


supports

public boolean supports(Object obj)
Specified by:
supports in interface ObjectWrapperPlugin

wrapSupportedObject

public freemarker.template.TemplateModel wrapSupportedObject(Object obj,
                                                             PluginObjectWrapper wrapper)
                                                      throws freemarker.template.TemplateModelException
Specified by:
wrapSupportedObject in interface ObjectWrapperPlugin
Throws:
freemarker.template.TemplateModelException