|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectfreemarker.ext.beans.BeansWrapper
org.apache.struts2.views.freemarker.StrutsBeanWrapper
public class StrutsBeanWrapper
The StrutsBeanWrapper extends the default FreeMarker BeansWrapper and provides almost no change in functionality, except for how it handles maps. Normally, FreeMarker has two modes of operation: either support for friendly map built-ins (?keys, ?values, etc) but only support for String keys; OR no special built-in support (ie: ?keys returns the methods on the map instead of the keys) but support for String and non-String keys alike. Struts provides an alternative implementation that gives us the best of both worlds.
It is possible that this special behavior may be confusing or can cause problems. Therefore, you can set the struts.freemarker.wrapper.altMap property in struts.properties to false, allowing the normal BeansWrapper logic to take place instead.
Nested Class Summary | |
---|---|
private static class |
StrutsBeanWrapper.FriendlyMapModel
Attempting to get the best of both worlds of FM's MapModel and SimpleMapModel, by reimplementing the isEmpty(), keySet() and values() methods. |
Field Summary | |
---|---|
private boolean |
altMapWrapper
|
Fields inherited from class freemarker.ext.beans.BeansWrapper |
---|
CAN_NOT_UNWRAP, EXPOSE_ALL, EXPOSE_NOTHING, EXPOSE_PROPERTIES_ONLY, EXPOSE_SAFE |
Fields inherited from interface freemarker.template.ObjectWrapper |
---|
BEANS_WRAPPER, DEFAULT_WRAPPER, SIMPLE_WRAPPER |
Constructor Summary | |
---|---|
StrutsBeanWrapper(boolean altMapWrapper)
|
Method Summary | |
---|---|
freemarker.template.TemplateModel |
wrap(Object object)
|
Methods inherited from class freemarker.ext.beans.BeansWrapper |
---|
coerceBigDecimal, coerceBigDecimals, coerceBigDecimals, getDefaultDateType, getDefaultInstance, getEnumModels, getInstance, getModelFactory, getOuterIdentity, getStaticModels, isExposeFields, isSimpleMapWrapper, isStrict, newInstance, setDefaultDateType, setExposeFields, setExposureLevel, setMethodsShadowItems, setNullModel, setOuterIdentity, setSimpleMapWrapper, setStrict, setUseCache, unwrap, unwrap |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private boolean altMapWrapper
Constructor Detail |
---|
StrutsBeanWrapper(boolean altMapWrapper)
Method Detail |
---|
public freemarker.template.TemplateModel wrap(Object object) throws freemarker.template.TemplateModelException
wrap
in interface freemarker.template.ObjectWrapper
wrap
in class freemarker.ext.beans.BeansWrapper
freemarker.template.TemplateModelException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |