| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> |
| <!-- NewPage --> |
| <html lang="en"> |
| <head> |
| <!-- Generated by javadoc (1.8.0_281) on Sun Jan 15 15:58:34 CET 2023 --> |
| <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> |
| <title>BeansWrapper (FreeMarker 2.3.32 API)</title> |
| <meta name="date" content="2023-01-15"> |
| <link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style"> |
| <script type="text/javascript" src="../../../script.js"></script> |
| </head> |
| <body> |
| <script type="text/javascript"><!-- |
| try { |
| if (location.href.indexOf('is-external=true') == -1) { |
| parent.document.title="BeansWrapper (FreeMarker 2.3.32 API)"; |
| } |
| } |
| catch(err) { |
| } |
| //--> |
| var methods = {"i0":10,"i1":42,"i2":10,"i3":9,"i4":9,"i5":9,"i6":10,"i7":42,"i8":10,"i9":41,"i10":10,"i11":10,"i12":10,"i13":42,"i14":10,"i15":10,"i16":10,"i17":10,"i18":10,"i19":10,"i20":10,"i21":10,"i22":10,"i23":10,"i24":10,"i25":10,"i26":10,"i27":10,"i28":10,"i29":9,"i30":10,"i31":10,"i32":10,"i33":10,"i34":10,"i35":10,"i36":10,"i37":10,"i38":42,"i39":10,"i40":10,"i41":10,"i42":10,"i43":10,"i44":10,"i45":10,"i46":10,"i47":10,"i48":10,"i49":10,"i50":10,"i51":10,"i52":10,"i53":10}; |
| var tabs = {65535:["t0","All Methods"],1:["t1","Static Methods"],2:["t2","Instance Methods"],8:["t4","Concrete Methods"],32:["t6","Deprecated Methods"]}; |
| var altColor = "altColor"; |
| var rowColor = "rowColor"; |
| var tableTab = "tableTab"; |
| var activeTableTab = "activeTableTab"; |
| </script> |
| <noscript> |
| <div>JavaScript is disabled on your browser.</div> |
| </noscript> |
| <!-- ========= START OF TOP NAVBAR ======= --> |
| <div class="topNav"><a name="navbar.top"> |
| <!-- --> |
| </a> |
| <div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div> |
| <a name="navbar.top.firstrow"> |
| <!-- --> |
| </a> |
| <ul class="navList" title="Navigation"> |
| <li><a href="../../../overview-summary.html">Overview</a></li> |
| <li><a href="package-summary.html">Package</a></li> |
| <li class="navBarCell1Rev">Class</li> |
| <li><a href="class-use/BeansWrapper.html">Use</a></li> |
| <li><a href="package-tree.html">Tree</a></li> |
| <li><a href="../../../deprecated-list.html">Deprecated</a></li> |
| <li><a href="../../../index-all.html">Index</a></li> |
| <li><a href="../../../help-doc.html">Help</a></li> |
| </ul> |
| </div> |
| <div class="subNav"> |
| <ul class="navList"> |
| <li><a href="../../../freemarker/ext/beans/BeansModelCache.html" title="class in freemarker.ext.beans"><span class="typeNameLink">Prev Class</span></a></li> |
| <li><a href="../../../freemarker/ext/beans/BeansWrapper.MethodAppearanceDecision.html" title="class in freemarker.ext.beans"><span class="typeNameLink">Next Class</span></a></li> |
| </ul> |
| <ul class="navList"> |
| <li><a href="../../../index.html?freemarker/ext/beans/BeansWrapper.html" target="_top">Frames</a></li> |
| <li><a href="BeansWrapper.html" target="_top">No Frames</a></li> |
| </ul> |
| <ul class="navList" id="allclasses_navbar_top"> |
| <li><a href="../../../allclasses-noframe.html">All Classes</a></li> |
| </ul> |
| <div> |
| <script type="text/javascript"><!-- |
| allClassesLink = document.getElementById("allclasses_navbar_top"); |
| if(window==top) { |
| allClassesLink.style.display = "block"; |
| } |
| else { |
| allClassesLink.style.display = "none"; |
| } |
| //--> |
| </script> |
| </div> |
| <div> |
| <ul class="subNavList"> |
| <li>Summary: </li> |
| <li><a href="#nested.class.summary">Nested</a> | </li> |
| <li><a href="#field.summary">Field</a> | </li> |
| <li><a href="#constructor.summary">Constr</a> | </li> |
| <li><a href="#method.summary">Method</a></li> |
| </ul> |
| <ul class="subNavList"> |
| <li>Detail: </li> |
| <li><a href="#field.detail">Field</a> | </li> |
| <li><a href="#constructor.detail">Constr</a> | </li> |
| <li><a href="#method.detail">Method</a></li> |
| </ul> |
| </div> |
| <a name="skip.navbar.top"> |
| <!-- --> |
| </a></div> |
| <!-- ========= END OF TOP NAVBAR ========= --> |
| <!-- ======== START OF CLASS DATA ======== --> |
| <div class="header"> |
| <div class="subTitle">freemarker.ext.beans</div> |
| <h2 title="Class BeansWrapper" class="title">Class BeansWrapper</h2> |
| </div> |
| <div class="contentContainer"> |
| <ul class="inheritance"> |
| <li>java.lang.Object</li> |
| <li> |
| <ul class="inheritance"> |
| <li>freemarker.ext.beans.BeansWrapper</li> |
| </ul> |
| </li> |
| </ul> |
| <div class="description"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <dl> |
| <dt>All Implemented Interfaces:</dt> |
| <dd><a href="../../../freemarker/template/ObjectWrapper.html" title="interface in freemarker.template">ObjectWrapper</a>, <a href="../../../freemarker/template/ObjectWrapperAndUnwrapper.html" title="interface in freemarker.template">ObjectWrapperAndUnwrapper</a>, <a href="../../../freemarker/template/utility/ObjectWrapperWithAPISupport.html" title="interface in freemarker.template.utility">ObjectWrapperWithAPISupport</a>, <a href="../../../freemarker/template/utility/RichObjectWrapper.html" title="interface in freemarker.template.utility">RichObjectWrapper</a>, <a href="../../../freemarker/template/utility/WriteProtectable.html" title="interface in freemarker.template.utility">WriteProtectable</a></dd> |
| </dl> |
| <dl> |
| <dt>Direct Known Subclasses:</dt> |
| <dd><a href="../../../freemarker/template/DefaultObjectWrapper.html" title="class in freemarker.template">DefaultObjectWrapper</a>, <a href="../../../freemarker/ext/rhino/RhinoWrapper.html" title="class in freemarker.ext.rhino">RhinoWrapper</a></dd> |
| </dl> |
| <hr> |
| <br> |
| <pre>public class <span class="typeNameLabel">BeansWrapper</span> |
| extends java.lang.Object |
| implements <a href="../../../freemarker/template/utility/RichObjectWrapper.html" title="interface in freemarker.template.utility">RichObjectWrapper</a>, <a href="../../../freemarker/template/utility/WriteProtectable.html" title="interface in freemarker.template.utility">WriteProtectable</a></pre> |
| <div class="block"><a href="../../../freemarker/template/ObjectWrapper.html" title="interface in freemarker.template"><code>ObjectWrapper</code></a> that is able to expose the Java API of arbitrary Java objects. This is also the superclass of |
| <a href="../../../freemarker/template/DefaultObjectWrapper.html" title="class in freemarker.template"><code>DefaultObjectWrapper</code></a>. Note that instances of this class generally should be created with a |
| <a href="../../../freemarker/ext/beans/BeansWrapperBuilder.html" title="class in freemarker.ext.beans"><code>BeansWrapperBuilder</code></a>, not with its public constructors. |
| |
| <p> |
| As of 2.3.22, using <a href="../../../freemarker/ext/beans/BeansWrapper.html" title="class in freemarker.ext.beans"><code>BeansWrapper</code></a> unextended is not recommended. Instead, <a href="../../../freemarker/template/DefaultObjectWrapper.html" title="class in freemarker.template"><code>DefaultObjectWrapper</code></a> with |
| its <code>incompatibleImprovements</code> property set to 2.3.22 (or higher) is the recommended <a href="../../../freemarker/template/ObjectWrapper.html" title="interface in freemarker.template"><code>ObjectWrapper</code></a>. |
| |
| <p> |
| This class is only thread-safe after you have finished calling its setter methods, and then safely published it (see |
| JSR 133 and related literature). When used as part of <a href="../../../freemarker/template/Configuration.html" title="class in freemarker.template"><code>Configuration</code></a>, of course it's enough if that was safely |
| published and then left unmodified. Using <a href="../../../freemarker/ext/beans/BeansWrapperBuilder.html" title="class in freemarker.ext.beans"><code>BeansWrapperBuilder</code></a> also guarantees thread safety.</div> |
| </li> |
| </ul> |
| </div> |
| <div class="summary"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <!-- ======== NESTED CLASS SUMMARY ======== --> |
| <ul class="blockList"> |
| <li class="blockList"><a name="nested.class.summary"> |
| <!-- --> |
| </a> |
| <h3>Nested Class Summary</h3> |
| <table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Nested Class Summary table, listing nested classes, and an explanation"> |
| <caption><span>Nested Classes</span><span class="tabEnd"> </span></caption> |
| <tr> |
| <th class="colFirst" scope="col">Modifier and Type</th> |
| <th class="colLast" scope="col">Class and Description</th> |
| </tr> |
| <tr class="altColor"> |
| <td class="colFirst"><code>static class </code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../freemarker/ext/beans/BeansWrapper.MethodAppearanceDecision.html" title="class in freemarker.ext.beans">BeansWrapper.MethodAppearanceDecision</a></span></code> |
| <div class="block">Used for |
| <a href="../../../freemarker/ext/beans/MethodAppearanceFineTuner.html#process-freemarker.ext.beans.BeansWrapper.MethodAppearanceDecisionInput-freemarker.ext.beans.BeansWrapper.MethodAppearanceDecision-"><code>MethodAppearanceFineTuner.process(freemarker.ext.beans.BeansWrapper.MethodAppearanceDecisionInput, freemarker.ext.beans.BeansWrapper.MethodAppearanceDecision)</code></a> |
| to store the results; see there.</div> |
| </td> |
| </tr> |
| <tr class="rowColor"> |
| <td class="colFirst"><code>static class </code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../freemarker/ext/beans/BeansWrapper.MethodAppearanceDecisionInput.html" title="class in freemarker.ext.beans">BeansWrapper.MethodAppearanceDecisionInput</a></span></code> |
| <div class="block">Used for <a href="../../../freemarker/ext/beans/MethodAppearanceFineTuner.html#process-freemarker.ext.beans.BeansWrapper.MethodAppearanceDecisionInput-freemarker.ext.beans.BeansWrapper.MethodAppearanceDecision-"><code>MethodAppearanceFineTuner.process(freemarker.ext.beans.BeansWrapper.MethodAppearanceDecisionInput, freemarker.ext.beans.BeansWrapper.MethodAppearanceDecision)</code></a> as input parameter; see there.</div> |
| </td> |
| </tr> |
| </table> |
| </li> |
| </ul> |
| <!-- =========== FIELD SUMMARY =========== --> |
| <ul class="blockList"> |
| <li class="blockList"><a name="field.summary"> |
| <!-- --> |
| </a> |
| <h3>Field Summary</h3> |
| <table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Field Summary table, listing fields, and an explanation"> |
| <caption><span>Fields</span><span class="tabEnd"> </span></caption> |
| <tr> |
| <th class="colFirst" scope="col">Modifier and Type</th> |
| <th class="colLast" scope="col">Field and Description</th> |
| </tr> |
| <tr class="altColor"> |
| <td class="colFirst"><code>static int</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../freemarker/ext/beans/BeansWrapper.html#EXPOSE_ALL">EXPOSE_ALL</a></span></code> |
| <div class="block">At this level of exposure, all methods and properties of the |
| wrapped objects are exposed to the template, and the <a href="../../../freemarker/ext/beans/MemberAccessPolicy.html" title="interface in freemarker.ext.beans"><code>MemberAccessPolicy</code></a> |
| will be ignored.</div> |
| </td> |
| </tr> |
| <tr class="rowColor"> |
| <td class="colFirst"><code>static int</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../freemarker/ext/beans/BeansWrapper.html#EXPOSE_NOTHING">EXPOSE_NOTHING</a></span></code> |
| <div class="block">At this level of exposure, no bean properties and methods are exposed.</div> |
| </td> |
| </tr> |
| <tr class="altColor"> |
| <td class="colFirst"><code>static int</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../freemarker/ext/beans/BeansWrapper.html#EXPOSE_PROPERTIES_ONLY">EXPOSE_PROPERTIES_ONLY</a></span></code> |
| <div class="block">At this level of exposure, only property getters are exposed.</div> |
| </td> |
| </tr> |
| <tr class="rowColor"> |
| <td class="colFirst"><code>static int</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../freemarker/ext/beans/BeansWrapper.html#EXPOSE_SAFE">EXPOSE_SAFE</a></span></code> |
| <div class="block">At this level of exposure, all methods and properties of the wrapped |
| objects are exposed to the template except methods that are deemed |
| not safe.</div> |
| </td> |
| </tr> |
| </table> |
| <ul class="blockList"> |
| <li class="blockList"><a name="fields.inherited.from.class.freemarker.template.ObjectWrapperAndUnwrapper"> |
| <!-- --> |
| </a> |
| <h3>Fields inherited from interface freemarker.template.<a href="../../../freemarker/template/ObjectWrapperAndUnwrapper.html" title="interface in freemarker.template">ObjectWrapperAndUnwrapper</a></h3> |
| <code><a href="../../../freemarker/template/ObjectWrapperAndUnwrapper.html#CANT_UNWRAP_TO_TARGET_CLASS">CANT_UNWRAP_TO_TARGET_CLASS</a></code></li> |
| </ul> |
| <ul class="blockList"> |
| <li class="blockList"><a name="fields.inherited.from.class.freemarker.template.ObjectWrapper"> |
| <!-- --> |
| </a> |
| <h3>Fields inherited from interface freemarker.template.<a href="../../../freemarker/template/ObjectWrapper.html" title="interface in freemarker.template">ObjectWrapper</a></h3> |
| <code><a href="../../../freemarker/template/ObjectWrapper.html#BEANS_WRAPPER">BEANS_WRAPPER</a>, <a href="../../../freemarker/template/ObjectWrapper.html#DEFAULT_WRAPPER">DEFAULT_WRAPPER</a>, <a href="../../../freemarker/template/ObjectWrapper.html#SIMPLE_WRAPPER">SIMPLE_WRAPPER</a></code></li> |
| </ul> |
| </li> |
| </ul> |
| <!-- ======== CONSTRUCTOR SUMMARY ======== --> |
| <ul class="blockList"> |
| <li class="blockList"><a name="constructor.summary"> |
| <!-- --> |
| </a> |
| <h3>Constructor Summary</h3> |
| <table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation"> |
| <caption><span>Constructors</span><span class="tabEnd"> </span></caption> |
| <tr> |
| <th class="colFirst" scope="col">Modifier</th> |
| <th class="colLast" scope="col">Constructor and Description</th> |
| </tr> |
| <tr class="altColor"> |
| <td class="colFirst"><code> </code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../freemarker/ext/beans/BeansWrapper.html#BeansWrapper--">BeansWrapper</a></span>()</code> |
| <div class="block"><span class="deprecatedLabel">Deprecated.</span> |
| <div class="block"><span class="deprecationComment">Use <a href="../../../freemarker/ext/beans/BeansWrapperBuilder.html" title="class in freemarker.ext.beans"><code>BeansWrapperBuilder</code></a> or, in rare cases, <a href="../../../freemarker/ext/beans/BeansWrapper.html#BeansWrapper-freemarker.template.Version-"><code>BeansWrapper(Version)</code></a> instead.</span></div> |
| </div> |
| </td> |
| </tr> |
| <tr class="rowColor"> |
| <td class="colFirst"><code>protected </code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../freemarker/ext/beans/BeansWrapper.html#BeansWrapper-freemarker.ext.beans.BeansWrapperConfiguration-boolean-">BeansWrapper</a></span>(<a href="../../../freemarker/ext/beans/BeansWrapperConfiguration.html" title="class in freemarker.ext.beans">BeansWrapperConfiguration</a> bwConf, |
| boolean writeProtected)</code> |
| <div class="block">Same as <a href="../../../freemarker/ext/beans/BeansWrapper.html#BeansWrapper-freemarker.ext.beans.BeansWrapperConfiguration-boolean-boolean-"><code>BeansWrapper(BeansWrapperConfiguration, boolean, boolean)</code></a> with <code>true</code> |
| <code>finalizeConstruction</code> argument.</div> |
| </td> |
| </tr> |
| <tr class="altColor"> |
| <td class="colFirst"><code>protected </code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../freemarker/ext/beans/BeansWrapper.html#BeansWrapper-freemarker.ext.beans.BeansWrapperConfiguration-boolean-boolean-">BeansWrapper</a></span>(<a href="../../../freemarker/ext/beans/BeansWrapperConfiguration.html" title="class in freemarker.ext.beans">BeansWrapperConfiguration</a> bwConf, |
| boolean writeProtected, |
| boolean finalizeConstruction)</code> |
| <div class="block">Initializes the instance based on the the <a href="../../../freemarker/ext/beans/BeansWrapperConfiguration.html" title="class in freemarker.ext.beans"><code>BeansWrapperConfiguration</code></a> specified.</div> |
| </td> |
| </tr> |
| <tr class="rowColor"> |
| <td class="colFirst"><code> </code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../freemarker/ext/beans/BeansWrapper.html#BeansWrapper-freemarker.template.Version-">BeansWrapper</a></span>(<a href="../../../freemarker/template/Version.html" title="class in freemarker.template">Version</a> incompatibleImprovements)</code> |
| <div class="block">Use <a href="../../../freemarker/ext/beans/BeansWrapperBuilder.html" title="class in freemarker.ext.beans"><code>BeansWrapperBuilder</code></a> instead of the public constructors if possible.</div> |
| </td> |
| </tr> |
| </table> |
| </li> |
| </ul> |
| <!-- ========== METHOD SUMMARY =========== --> |
| <ul class="blockList"> |
| <li class="blockList"><a name="method.summary"> |
| <!-- --> |
| </a> |
| <h3>Method Summary</h3> |
| <table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation"> |
| <caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd"> </span></span><span id="t1" class="tableTab"><span><a href="javascript:show(1);">Static Methods</a></span><span class="tabEnd"> </span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd"> </span></span><span id="t4" class="tableTab"><span><a href="javascript:show(8);">Concrete Methods</a></span><span class="tabEnd"> </span></span><span id="t6" class="tableTab"><span><a href="javascript:show(32);">Deprecated Methods</a></span><span class="tabEnd"> </span></span></caption> |
| <tr> |
| <th class="colFirst" scope="col">Modifier and Type</th> |
| <th class="colLast" scope="col">Method and Description</th> |
| </tr> |
| <tr id="i0" class="altColor"> |
| <td class="colFirst"><code>protected void</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../freemarker/ext/beans/BeansWrapper.html#checkModifiable--">checkModifiable</a></span>()</code> |
| <div class="block">If this object is already read-only according to <a href="../../../freemarker/template/utility/WriteProtectable.html" title="interface in freemarker.template.utility"><code>WriteProtectable</code></a>, throws <code>IllegalStateException</code>, |
| otherwise does nothing.</div> |
| </td> |
| </tr> |
| <tr id="i1" class="rowColor"> |
| <td class="colFirst"><code>void</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../freemarker/ext/beans/BeansWrapper.html#clearClassIntrospecitonCache--">clearClassIntrospecitonCache</a></span>()</code> |
| <div class="block"><span class="deprecatedLabel">Deprecated.</span> |
| <div class="block"><span class="deprecationComment">There's a typo in this method name, so use <a href="../../../freemarker/ext/beans/BeansWrapper.html#clearClassIntrospectionCache--"><code>clearClassIntrospectionCache()</code></a> instead.</span></div> |
| </div> |
| </td> |
| </tr> |
| <tr id="i2" class="altColor"> |
| <td class="colFirst"><code>void</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../freemarker/ext/beans/BeansWrapper.html#clearClassIntrospectionCache--">clearClassIntrospectionCache</a></span>()</code> |
| <div class="block">Removes all class introspection data from the cache.</div> |
| </td> |
| </tr> |
| <tr id="i3" class="rowColor"> |
| <td class="colFirst"><code>static java.lang.Object</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../freemarker/ext/beans/BeansWrapper.html#coerceBigDecimal-java.math.BigDecimal-java.lang.Class-">coerceBigDecimal</a></span>(java.math.BigDecimal bd, |
| java.lang.Class<?> formalType)</code> |
| <div class="block">Converts <code>BigDecimal</code> to the class given in the <code>formalType</code> argument if that's a known numerical |
| type, returns the <code>BigDecimal</code> as is otherwise.</div> |
| </td> |
| </tr> |
| <tr id="i4" class="altColor"> |
| <td class="colFirst"><code>static void</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../freemarker/ext/beans/BeansWrapper.html#coerceBigDecimals-java.lang.reflect.AccessibleObject-java.lang.Object:A-">coerceBigDecimals</a></span>(java.lang.reflect.AccessibleObject callable, |
| java.lang.Object[] args)</code> |
| <div class="block">Converts any <code>BigDecimal</code>s in the passed array to the type of |
| the corresponding formal argument of the method.</div> |
| </td> |
| </tr> |
| <tr id="i5" class="rowColor"> |
| <td class="colFirst"><code>static void</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../freemarker/ext/beans/BeansWrapper.html#coerceBigDecimals-java.lang.Class:A-java.lang.Object:A-">coerceBigDecimals</a></span>(java.lang.Class<?>[] formalTypes, |
| java.lang.Object[] args)</code> |
| <div class="block">Converts any <code>BigDecimal</code>-s in the passed array to the type of |
| the corresponding formal argument of the method via <a href="../../../freemarker/ext/beans/BeansWrapper.html#coerceBigDecimal-java.math.BigDecimal-java.lang.Class-"><code>coerceBigDecimal(BigDecimal, Class)</code></a>.</div> |
| </td> |
| </tr> |
| <tr id="i6" class="altColor"> |
| <td class="colFirst"><code>protected void</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../freemarker/ext/beans/BeansWrapper.html#finalizeConstruction-boolean-">finalizeConstruction</a></span>(boolean writeProtected)</code> |
| <div class="block">Meant to be called after <a href="../../../freemarker/ext/beans/BeansWrapper.html#BeansWrapper-freemarker.ext.beans.BeansWrapperConfiguration-boolean-boolean-"><code>BeansWrapper(BeansWrapperConfiguration, boolean, boolean)</code></a> when |
| its last argument was <code>false</code>; makes the instance read-only if necessary, then registers the model |
| factories in the class introspector.</div> |
| </td> |
| </tr> |
| <tr id="i7" class="rowColor"> |
| <td class="colFirst"><code>protected void</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../freemarker/ext/beans/BeansWrapper.html#finetuneMethodAppearance-java.lang.Class-java.lang.reflect.Method-freemarker.ext.beans.BeansWrapper.MethodAppearanceDecision-">finetuneMethodAppearance</a></span>(java.lang.Class<?> clazz, |
| java.lang.reflect.Method m, |
| <a href="../../../freemarker/ext/beans/BeansWrapper.MethodAppearanceDecision.html" title="class in freemarker.ext.beans">BeansWrapper.MethodAppearanceDecision</a> decision)</code> |
| <div class="block"><span class="deprecatedLabel">Deprecated.</span> |
| <div class="block"><span class="deprecationComment">Use <a href="../../../freemarker/ext/beans/BeansWrapper.html#setMethodAppearanceFineTuner-freemarker.ext.beans.MethodAppearanceFineTuner-"><code>setMethodAppearanceFineTuner(MethodAppearanceFineTuner)</code></a>; |
| no need to extend this class anymore. |
| Soon this method will be final, so trying to override it will break your app. |
| Note that if the <code>methodAppearanceFineTuner</code> property is set to non-<code>null</code>, this method is not |
| called anymore.</span></div> |
| </div> |
| </td> |
| </tr> |
| <tr id="i8" class="altColor"> |
| <td class="colFirst"><code>int</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../freemarker/ext/beans/BeansWrapper.html#getDefaultDateType--">getDefaultDateType</a></span>()</code> |
| <div class="block">Returns the default date type.</div> |
| </td> |
| </tr> |
| <tr id="i9" class="rowColor"> |
| <td class="colFirst"><code>static <a href="../../../freemarker/ext/beans/BeansWrapper.html" title="class in freemarker.ext.beans">BeansWrapper</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../freemarker/ext/beans/BeansWrapper.html#getDefaultInstance--">getDefaultInstance</a></span>()</code> |
| <div class="block"><span class="deprecatedLabel">Deprecated.</span> |
| <div class="block"><span class="deprecationComment">Use <a href="../../../freemarker/ext/beans/BeansWrapperBuilder.html" title="class in freemarker.ext.beans"><code>BeansWrapperBuilder</code></a> instead. The instance returned here is not read-only, so it's |
| dangerous to use.</span></div> |
| </div> |
| </td> |
| </tr> |
| <tr id="i10" class="altColor"> |
| <td class="colFirst"><code><a href="../../../freemarker/template/TemplateHashModel.html" title="interface in freemarker.template">TemplateHashModel</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../freemarker/ext/beans/BeansWrapper.html#getEnumModels--">getEnumModels</a></span>()</code> |
| <div class="block">Returns a hash model that represents the so-called class enum models.</div> |
| </td> |
| </tr> |
| <tr id="i11" class="rowColor"> |
| <td class="colFirst"><code>int</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../freemarker/ext/beans/BeansWrapper.html#getExposureLevel--">getExposureLevel</a></span>()</code> </td> |
| </tr> |
| <tr id="i12" class="altColor"> |
| <td class="colFirst"><code><a href="../../../freemarker/template/Version.html" title="class in freemarker.template">Version</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../freemarker/ext/beans/BeansWrapper.html#getIncompatibleImprovements--">getIncompatibleImprovements</a></span>()</code> |
| <div class="block">Returns the version given with <a href="../../../freemarker/ext/beans/BeansWrapper.html#BeansWrapper-freemarker.template.Version-"><code>BeansWrapper(Version)</code></a>, normalized to the lowest version where a change |
| has occurred.</div> |
| </td> |
| </tr> |
| <tr id="i13" class="rowColor"> |
| <td class="colFirst"><code>protected <a href="../../../freemarker/template/TemplateModel.html" title="interface in freemarker.template">TemplateModel</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../freemarker/ext/beans/BeansWrapper.html#getInstance-java.lang.Object-freemarker.ext.util.ModelFactory-">getInstance</a></span>(java.lang.Object object, |
| <a href="../../../freemarker/ext/util/ModelFactory.html" title="interface in freemarker.ext.util">ModelFactory</a> factory)</code> |
| <div class="block"><span class="deprecatedLabel">Deprecated.</span> |
| <div class="block"><span class="deprecationComment">override <a href="../../../freemarker/ext/beans/BeansWrapper.html#getModelFactory-java.lang.Class-"><code>getModelFactory(Class)</code></a> instead. Using this |
| method will now bypass wrapper caching (if it's enabled) and always |
| result in creation of a new wrapper. This method will be removed in 2.4</span></div> |
| </div> |
| </td> |
| </tr> |
| <tr id="i14" class="altColor"> |
| <td class="colFirst"><code><a href="../../../freemarker/ext/beans/MemberAccessPolicy.html" title="interface in freemarker.ext.beans">MemberAccessPolicy</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../freemarker/ext/beans/BeansWrapper.html#getMemberAccessPolicy--">getMemberAccessPolicy</a></span>()</code> </td> |
| </tr> |
| <tr id="i15" class="rowColor"> |
| <td class="colFirst"><code><a href="../../../freemarker/ext/beans/MethodAppearanceFineTuner.html" title="interface in freemarker.ext.beans">MethodAppearanceFineTuner</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../freemarker/ext/beans/BeansWrapper.html#getMethodAppearanceFineTuner--">getMethodAppearanceFineTuner</a></span>()</code> </td> |
| </tr> |
| <tr id="i16" class="altColor"> |
| <td class="colFirst"><code>protected <a href="../../../freemarker/ext/util/ModelFactory.html" title="interface in freemarker.ext.util">ModelFactory</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../freemarker/ext/beans/BeansWrapper.html#getModelFactory-java.lang.Class-">getModelFactory</a></span>(java.lang.Class<?> clazz)</code> </td> |
| </tr> |
| <tr id="i17" class="rowColor"> |
| <td class="colFirst"><code><a href="../../../freemarker/template/ObjectWrapper.html" title="interface in freemarker.template">ObjectWrapper</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../freemarker/ext/beans/BeansWrapper.html#getOuterIdentity--">getOuterIdentity</a></span>()</code> |
| <div class="block">By default returns <tt>this</tt>.</div> |
| </td> |
| </tr> |
| <tr id="i18" class="altColor"> |
| <td class="colFirst"><code>boolean</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../freemarker/ext/beans/BeansWrapper.html#getPreferIndexedReadMethod--">getPreferIndexedReadMethod</a></span>()</code> |
| <div class="block">Getter pair of <a href="../../../freemarker/ext/beans/BeansWrapper.html#setPreferIndexedReadMethod-boolean-"><code>setPreferIndexedReadMethod(boolean)</code></a></div> |
| </td> |
| </tr> |
| <tr id="i19" class="rowColor"> |
| <td class="colFirst"><code><a href="../../../freemarker/template/TemplateHashModel.html" title="interface in freemarker.template">TemplateHashModel</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../freemarker/ext/beans/BeansWrapper.html#getStaticModels--">getStaticModels</a></span>()</code> |
| <div class="block">Returns a hash model that represents the so-called class static models.</div> |
| </td> |
| </tr> |
| <tr id="i20" class="altColor"> |
| <td class="colFirst"><code>boolean</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../freemarker/ext/beans/BeansWrapper.html#getTreatDefaultMethodsAsBeanMembers--">getTreatDefaultMethodsAsBeanMembers</a></span>()</code> |
| <div class="block">See <a href="../../../freemarker/ext/beans/BeansWrapper.html#setTreatDefaultMethodsAsBeanMembers-boolean-"><code>setTreatDefaultMethodsAsBeanMembers(boolean)</code></a>.</div> |
| </td> |
| </tr> |
| <tr id="i21" class="rowColor"> |
| <td class="colFirst"><code>boolean</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../freemarker/ext/beans/BeansWrapper.html#getUseCache--">getUseCache</a></span>()</code> </td> |
| </tr> |
| <tr id="i22" class="altColor"> |
| <td class="colFirst"><code>protected <a href="../../../freemarker/template/TemplateModel.html" title="interface in freemarker.template">TemplateModel</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../freemarker/ext/beans/BeansWrapper.html#invokeMethod-java.lang.Object-java.lang.reflect.Method-java.lang.Object:A-">invokeMethod</a></span>(java.lang.Object object, |
| java.lang.reflect.Method method, |
| java.lang.Object[] args)</code> |
| <div class="block">Invokes the specified method, wrapping the return value.</div> |
| </td> |
| </tr> |
| <tr id="i23" class="rowColor"> |
| <td class="colFirst"><code>boolean</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../freemarker/ext/beans/BeansWrapper.html#isClassIntrospectionCacheRestricted--">isClassIntrospectionCacheRestricted</a></span>()</code> |
| <div class="block">Tells if this instance acts like if its class introspection cache is sharable with other <a href="../../../freemarker/ext/beans/BeansWrapper.html" title="class in freemarker.ext.beans"><code>BeansWrapper</code></a>-s.</div> |
| </td> |
| </tr> |
| <tr id="i24" class="altColor"> |
| <td class="colFirst"><code>boolean</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../freemarker/ext/beans/BeansWrapper.html#isExposeFields--">isExposeFields</a></span>()</code> |
| <div class="block">Returns whether exposure of public instance fields of classes is |
| enabled.</div> |
| </td> |
| </tr> |
| <tr id="i25" class="rowColor"> |
| <td class="colFirst"><code>boolean</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../freemarker/ext/beans/BeansWrapper.html#isSimpleMapWrapper--">isSimpleMapWrapper</a></span>()</code> |
| <div class="block">Tells whether Maps are exposed as simple maps, without access to their |
| method.</div> |
| </td> |
| </tr> |
| <tr id="i26" class="altColor"> |
| <td class="colFirst"><code>boolean</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../freemarker/ext/beans/BeansWrapper.html#isStrict--">isStrict</a></span>()</code> </td> |
| </tr> |
| <tr id="i27" class="rowColor"> |
| <td class="colFirst"><code>boolean</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../freemarker/ext/beans/BeansWrapper.html#isWriteProtected--">isWriteProtected</a></span>()</code> </td> |
| </tr> |
| <tr id="i28" class="altColor"> |
| <td class="colFirst"><code>java.lang.Object</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../freemarker/ext/beans/BeansWrapper.html#newInstance-java.lang.Class-java.util.List-">newInstance</a></span>(java.lang.Class<?> clazz, |
| java.util.List arguments)</code> |
| <div class="block">Creates a new instance of the specified class using the method call logic of this object wrapper for calling the |
| constructor.</div> |
| </td> |
| </tr> |
| <tr id="i29" class="rowColor"> |
| <td class="colFirst"><code>protected static <a href="../../../freemarker/template/Version.html" title="class in freemarker.template">Version</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../freemarker/ext/beans/BeansWrapper.html#normalizeIncompatibleImprovementsVersion-freemarker.template.Version-">normalizeIncompatibleImprovementsVersion</a></span>(<a href="../../../freemarker/template/Version.html" title="class in freemarker.template">Version</a> incompatibleImprovements)</code> |
| <div class="block">Returns the lowest version number that is equivalent with the parameter version.</div> |
| </td> |
| </tr> |
| <tr id="i30" class="altColor"> |
| <td class="colFirst"><code>protected <a href="../../../freemarker/template/TemplateModel.html" title="interface in freemarker.template">TemplateModel</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../freemarker/ext/beans/BeansWrapper.html#readField-java.lang.Object-java.lang.reflect.Field-">readField</a></span>(java.lang.Object object, |
| java.lang.reflect.Field field)</code> |
| <div class="block">Reads the specified field, returns its value as <a href="../../../freemarker/template/TemplateModel.html" title="interface in freemarker.template"><code>TemplateModel</code></a>.</div> |
| </td> |
| </tr> |
| <tr id="i31" class="rowColor"> |
| <td class="colFirst"><code>void</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../freemarker/ext/beans/BeansWrapper.html#removeFromClassIntrospectionCache-java.lang.Class-">removeFromClassIntrospectionCache</a></span>(java.lang.Class<?> clazz)</code> |
| <div class="block">Removes the introspection data for a class from the cache.</div> |
| </td> |
| </tr> |
| <tr id="i32" class="altColor"> |
| <td class="colFirst"><code>void</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../freemarker/ext/beans/BeansWrapper.html#setDefaultDateType-int-">setDefaultDateType</a></span>(int defaultDateType)</code> |
| <div class="block">Sets the default date type to use for date models that result from |
| a plain <tt>java.util.Date</tt> instead of <tt>java.sql.Date</tt> or |
| <tt>java.sql.Time</tt> or <tt>java.sql.Timestamp</tt>.</div> |
| </td> |
| </tr> |
| <tr id="i33" class="rowColor"> |
| <td class="colFirst"><code>void</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../freemarker/ext/beans/BeansWrapper.html#setExposeFields-boolean-">setExposeFields</a></span>(boolean exposeFields)</code> |
| <div class="block">Controls whether public instance fields of classes are exposed to |
| templates.</div> |
| </td> |
| </tr> |
| <tr id="i34" class="altColor"> |
| <td class="colFirst"><code>void</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../freemarker/ext/beans/BeansWrapper.html#setExposureLevel-int-">setExposureLevel</a></span>(int exposureLevel)</code> |
| <div class="block">Sets the method exposure level.</div> |
| </td> |
| </tr> |
| <tr id="i35" class="rowColor"> |
| <td class="colFirst"><code>void</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../freemarker/ext/beans/BeansWrapper.html#setMemberAccessPolicy-freemarker.ext.beans.MemberAccessPolicy-">setMemberAccessPolicy</a></span>(<a href="../../../freemarker/ext/beans/MemberAccessPolicy.html" title="interface in freemarker.ext.beans">MemberAccessPolicy</a> memberAccessPolicy)</code> |
| <div class="block">Sets the <a href="../../../freemarker/ext/beans/MemberAccessPolicy.html" title="interface in freemarker.ext.beans"><code>MemberAccessPolicy</code></a>; default is <a href="../../../freemarker/ext/beans/DefaultMemberAccessPolicy.html#getInstance-freemarker.template.Version-"><code>DefaultMemberAccessPolicy.getInstance(Version)</code></a>, which |
| is not appropriate if template editors aren't trusted.</div> |
| </td> |
| </tr> |
| <tr id="i36" class="altColor"> |
| <td class="colFirst"><code>void</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../freemarker/ext/beans/BeansWrapper.html#setMethodAppearanceFineTuner-freemarker.ext.beans.MethodAppearanceFineTuner-">setMethodAppearanceFineTuner</a></span>(<a href="../../../freemarker/ext/beans/MethodAppearanceFineTuner.html" title="interface in freemarker.ext.beans">MethodAppearanceFineTuner</a> methodAppearanceFineTuner)</code> |
| <div class="block">Used to tweak certain aspects of how methods appear in the data-model; |
| see <a href="../../../freemarker/ext/beans/MethodAppearanceFineTuner.html" title="interface in freemarker.ext.beans"><code>MethodAppearanceFineTuner</code></a> for more.</div> |
| </td> |
| </tr> |
| <tr id="i37" class="rowColor"> |
| <td class="colFirst"><code>void</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../freemarker/ext/beans/BeansWrapper.html#setMethodsShadowItems-boolean-">setMethodsShadowItems</a></span>(boolean methodsShadowItems)</code> |
| <div class="block">Sets whether methods shadow items in beans.</div> |
| </td> |
| </tr> |
| <tr id="i38" class="altColor"> |
| <td class="colFirst"><code>void</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../freemarker/ext/beans/BeansWrapper.html#setNullModel-freemarker.template.TemplateModel-">setNullModel</a></span>(<a href="../../../freemarker/template/TemplateModel.html" title="interface in freemarker.template">TemplateModel</a> nullModel)</code> |
| <div class="block"><span class="deprecatedLabel">Deprecated.</span> |
| <div class="block"><span class="deprecationComment">Changing the <code>null</code> model can cause a lot of confusion; don't do it.</span></div> |
| </div> |
| </td> |
| </tr> |
| <tr id="i39" class="rowColor"> |
| <td class="colFirst"><code>void</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../freemarker/ext/beans/BeansWrapper.html#setOuterIdentity-freemarker.template.ObjectWrapper-">setOuterIdentity</a></span>(<a href="../../../freemarker/template/ObjectWrapper.html" title="interface in freemarker.template">ObjectWrapper</a> outerIdentity)</code> |
| <div class="block">When wrapping an object, the BeansWrapper commonly needs to wrap |
| "sub-objects", for example each element in a wrapped collection.</div> |
| </td> |
| </tr> |
| <tr id="i40" class="altColor"> |
| <td class="colFirst"><code>void</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../freemarker/ext/beans/BeansWrapper.html#setPreferIndexedReadMethod-boolean-">setPreferIndexedReadMethod</a></span>(boolean preferIndexedReadMethod)</code> |
| <div class="block">Sets if when a JavaBean property has both a normal read method (like <code>String[] getFoos()</code>) and an indexed |
| read method (like <code>String getFoos(int index)</code>), and the Java <code>Introspector</code> exposes both (which only |
| happens since Java 8, apparently), which read method will be used when the property is accessed with the |
| shorthand syntax (like <code>myObj.foos</code>).</div> |
| </td> |
| </tr> |
| <tr id="i41" class="rowColor"> |
| <td class="colFirst"><code>void</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../freemarker/ext/beans/BeansWrapper.html#setSimpleMapWrapper-boolean-">setSimpleMapWrapper</a></span>(boolean simpleMapWrapper)</code> |
| <div class="block">When set to <code>true</code>, the keys in <code>Map</code>-s won't mix with the method names when looking at them |
| from templates.</div> |
| </td> |
| </tr> |
| <tr id="i42" class="altColor"> |
| <td class="colFirst"><code>void</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../freemarker/ext/beans/BeansWrapper.html#setStrict-boolean-">setStrict</a></span>(boolean strict)</code> |
| <div class="block">Specifies if an attempt to read a bean property that doesn't exist in the |
| wrapped object should throw an <a href="../../../freemarker/ext/beans/InvalidPropertyException.html" title="class in freemarker.ext.beans"><code>InvalidPropertyException</code></a>.</div> |
| </td> |
| </tr> |
| <tr id="i43" class="rowColor"> |
| <td class="colFirst"><code>void</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../freemarker/ext/beans/BeansWrapper.html#setTreatDefaultMethodsAsBeanMembers-boolean-">setTreatDefaultMethodsAsBeanMembers</a></span>(boolean treatDefaultMethodsAsBeanMembers)</code> |
| <div class="block">Controls whether Java 8 default methods that weren't overridden in a class will be recognized as bean property |
| accessors and/or bean actions, and thus will be visible from templates.</div> |
| </td> |
| </tr> |
| <tr id="i44" class="altColor"> |
| <td class="colFirst"><code>void</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../freemarker/ext/beans/BeansWrapper.html#setUseCache-boolean-">setUseCache</a></span>(boolean useCache)</code> |
| <div class="block">Sets whether this wrapper caches the <a href="../../../freemarker/template/TemplateModel.html" title="interface in freemarker.template"><code>TemplateModel</code></a>-s created for the Java objects that has wrapped with |
| this object wrapper.</div> |
| </td> |
| </tr> |
| <tr id="i45" class="rowColor"> |
| <td class="colFirst"><code>protected java.lang.String</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../freemarker/ext/beans/BeansWrapper.html#toPropertiesString--">toPropertiesString</a></span>()</code> |
| <div class="block">Returns the name-value pairs that describe the configuration of this <a href="../../../freemarker/ext/beans/BeansWrapper.html" title="class in freemarker.ext.beans"><code>BeansWrapper</code></a>; called from |
| <a href="../../../freemarker/ext/beans/BeansWrapper.html#toString--"><code>toString()</code></a>.</div> |
| </td> |
| </tr> |
| <tr id="i46" class="altColor"> |
| <td class="colFirst"><code>java.lang.String</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../freemarker/ext/beans/BeansWrapper.html#toString--">toString</a></span>()</code> |
| <div class="block">Returns the exact class name and the identity hash, also the values of the most often used <a href="../../../freemarker/ext/beans/BeansWrapper.html" title="class in freemarker.ext.beans"><code>BeansWrapper</code></a> |
| configuration properties, also if which (if any) shared class introspection cache it uses.</div> |
| </td> |
| </tr> |
| <tr id="i47" class="rowColor"> |
| <td class="colFirst"><code>java.lang.Object</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../freemarker/ext/beans/BeansWrapper.html#tryUnwrapTo-freemarker.template.TemplateModel-java.lang.Class-">tryUnwrapTo</a></span>(<a href="../../../freemarker/template/TemplateModel.html" title="interface in freemarker.template">TemplateModel</a> model, |
| java.lang.Class<?> targetClass)</code> |
| <div class="block">Attempts to unwrap a <a href="../../../freemarker/template/TemplateModel.html" title="interface in freemarker.template"><code>TemplateModel</code></a> to a plain Java object that's the instance of the given class (or is |
| <code>null</code>).</div> |
| </td> |
| </tr> |
| <tr id="i48" class="altColor"> |
| <td class="colFirst"><code>java.lang.Object</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../freemarker/ext/beans/BeansWrapper.html#unwrap-freemarker.template.TemplateModel-">unwrap</a></span>(<a href="../../../freemarker/template/TemplateModel.html" title="interface in freemarker.template">TemplateModel</a> model)</code> |
| <div class="block">Attempts to unwrap a model into underlying object.</div> |
| </td> |
| </tr> |
| <tr id="i49" class="rowColor"> |
| <td class="colFirst"><code>java.lang.Object</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../freemarker/ext/beans/BeansWrapper.html#unwrap-freemarker.template.TemplateModel-java.lang.Class-">unwrap</a></span>(<a href="../../../freemarker/template/TemplateModel.html" title="interface in freemarker.template">TemplateModel</a> model, |
| java.lang.Class<?> targetClass)</code> |
| <div class="block">Attempts to unwrap a model into an object of the desired class.</div> |
| </td> |
| </tr> |
| <tr id="i50" class="altColor"> |
| <td class="colFirst"><code><a href="../../../freemarker/template/TemplateModel.html" title="interface in freemarker.template">TemplateModel</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../freemarker/ext/beans/BeansWrapper.html#wrap-java.lang.Object-">wrap</a></span>(java.lang.Object object)</code> |
| <div class="block">Wraps the object with a template model that is most specific for the object's |
| class.</div> |
| </td> |
| </tr> |
| <tr id="i51" class="rowColor"> |
| <td class="colFirst"><code><a href="../../../freemarker/template/TemplateMethodModelEx.html" title="interface in freemarker.template">TemplateMethodModelEx</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../freemarker/ext/beans/BeansWrapper.html#wrap-java.lang.Object-java.lang.reflect.Method-">wrap</a></span>(java.lang.Object object, |
| java.lang.reflect.Method method)</code> |
| <div class="block">Wraps a Java method so that it can be called from templates, without wrapping its parent ("this") object.</div> |
| </td> |
| </tr> |
| <tr id="i52" class="altColor"> |
| <td class="colFirst"><code><a href="../../../freemarker/template/TemplateHashModel.html" title="interface in freemarker.template">TemplateHashModel</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../freemarker/ext/beans/BeansWrapper.html#wrapAsAPI-java.lang.Object-">wrapAsAPI</a></span>(java.lang.Object obj)</code> |
| <div class="block">Wraps an object to a <a href="../../../freemarker/template/TemplateModel.html" title="interface in freemarker.template"><code>TemplateModel</code></a> that exposes the object's "native" (usually, Java) API.</div> |
| </td> |
| </tr> |
| <tr id="i53" class="rowColor"> |
| <td class="colFirst"><code>void</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../freemarker/ext/beans/BeansWrapper.html#writeProtect--">writeProtect</a></span>()</code> |
| <div class="block">Makes the configuration properties (settings) of this <a href="../../../freemarker/ext/beans/BeansWrapper.html" title="class in freemarker.ext.beans"><code>BeansWrapper</code></a> object read-only.</div> |
| </td> |
| </tr> |
| </table> |
| <ul class="blockList"> |
| <li class="blockList"><a name="methods.inherited.from.class.java.lang.Object"> |
| <!-- --> |
| </a> |
| <h3>Methods inherited from class java.lang.Object</h3> |
| <code>clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait</code></li> |
| </ul> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| </div> |
| <div class="details"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <!-- ============ FIELD DETAIL =========== --> |
| <ul class="blockList"> |
| <li class="blockList"><a name="field.detail"> |
| <!-- --> |
| </a> |
| <h3>Field Detail</h3> |
| <a name="EXPOSE_ALL"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>EXPOSE_ALL</h4> |
| <pre>public static final int EXPOSE_ALL</pre> |
| <div class="block">At this level of exposure, all methods and properties of the |
| wrapped objects are exposed to the template, and the <a href="../../../freemarker/ext/beans/MemberAccessPolicy.html" title="interface in freemarker.ext.beans"><code>MemberAccessPolicy</code></a> |
| will be ignored.</div> |
| <dl> |
| <dt><span class="seeLabel">See Also:</span></dt> |
| <dd><a href="../../../constant-values.html#freemarker.ext.beans.BeansWrapper.EXPOSE_ALL">Constant Field Values</a></dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="EXPOSE_SAFE"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>EXPOSE_SAFE</h4> |
| <pre>public static final int EXPOSE_SAFE</pre> |
| <div class="block">At this level of exposure, all methods and properties of the wrapped |
| objects are exposed to the template except methods that are deemed |
| not safe. The not safe methods are java.lang.Object methods wait() and |
| notify(), java.lang.Class methods getClassLoader() and newInstance(), |
| java.lang.reflect.Method and java.lang.reflect.Constructor invoke() and |
| newInstance() methods, all java.lang.reflect.Field set methods, all |
| java.lang.Thread and java.lang.ThreadGroup methods that can change its |
| state, as well as the usual suspects in java.lang.System and |
| java.lang.Runtime.</div> |
| <dl> |
| <dt><span class="seeLabel">See Also:</span></dt> |
| <dd><a href="../../../constant-values.html#freemarker.ext.beans.BeansWrapper.EXPOSE_SAFE">Constant Field Values</a></dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="EXPOSE_PROPERTIES_ONLY"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>EXPOSE_PROPERTIES_ONLY</h4> |
| <pre>public static final int EXPOSE_PROPERTIES_ONLY</pre> |
| <div class="block">At this level of exposure, only property getters are exposed. |
| Additionally, property getters that map to unsafe methods are not |
| exposed (i.e. Class.classLoader and Thread.contextClassLoader).</div> |
| <dl> |
| <dt><span class="seeLabel">See Also:</span></dt> |
| <dd><a href="../../../constant-values.html#freemarker.ext.beans.BeansWrapper.EXPOSE_PROPERTIES_ONLY">Constant Field Values</a></dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="EXPOSE_NOTHING"> |
| <!-- --> |
| </a> |
| <ul class="blockListLast"> |
| <li class="blockList"> |
| <h4>EXPOSE_NOTHING</h4> |
| <pre>public static final int EXPOSE_NOTHING</pre> |
| <div class="block">At this level of exposure, no bean properties and methods are exposed. |
| Only map items, resource bundle items, and objects retrieved through |
| the generic get method (on objects of classes that have a generic get |
| method) can be retrieved through the hash interface. You might want to |
| call <a href="../../../freemarker/ext/beans/BeansWrapper.html#setMethodsShadowItems-boolean-"><code>setMethodsShadowItems(boolean)</code></a> with <tt>false</tt> value to |
| speed up map item retrieval.</div> |
| <dl> |
| <dt><span class="seeLabel">See Also:</span></dt> |
| <dd><a href="../../../constant-values.html#freemarker.ext.beans.BeansWrapper.EXPOSE_NOTHING">Constant Field Values</a></dd> |
| </dl> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| <!-- ========= CONSTRUCTOR DETAIL ======== --> |
| <ul class="blockList"> |
| <li class="blockList"><a name="constructor.detail"> |
| <!-- --> |
| </a> |
| <h3>Constructor Detail</h3> |
| <a name="BeansWrapper--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>BeansWrapper</h4> |
| <pre>@Deprecated |
| public BeansWrapper()</pre> |
| <div class="block"><span class="deprecatedLabel">Deprecated.</span> <span class="deprecationComment">Use <a href="../../../freemarker/ext/beans/BeansWrapperBuilder.html" title="class in freemarker.ext.beans"><code>BeansWrapperBuilder</code></a> or, in rare cases, <a href="../../../freemarker/ext/beans/BeansWrapper.html#BeansWrapper-freemarker.template.Version-"><code>BeansWrapper(Version)</code></a> instead.</span></div> |
| <div class="block">Creates a new instance with the incompatible-improvements-version specified in |
| <a href="../../../freemarker/template/Configuration.html#DEFAULT_INCOMPATIBLE_IMPROVEMENTS"><code>Configuration.DEFAULT_INCOMPATIBLE_IMPROVEMENTS</code></a>.</div> |
| </li> |
| </ul> |
| <a name="BeansWrapper-freemarker.template.Version-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>BeansWrapper</h4> |
| <pre>public BeansWrapper(<a href="../../../freemarker/template/Version.html" title="class in freemarker.template">Version</a> incompatibleImprovements)</pre> |
| <div class="block">Use <a href="../../../freemarker/ext/beans/BeansWrapperBuilder.html" title="class in freemarker.ext.beans"><code>BeansWrapperBuilder</code></a> instead of the public constructors if possible. |
| The main disadvantage of using the public constructors is that the instances won't share caches. So unless having |
| a private cache is your goal, don't use them. See</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>incompatibleImprovements</code> - Sets which of the non-backward-compatible improvements should be enabled. Not <code>null</code>. This version number |
| is the same as the FreeMarker version number with which the improvements were implemented. |
| |
| <p>For new projects, it's recommended to set this to the FreeMarker version that's used during the development. |
| For released products that are still actively developed it's a low risk change to increase the 3rd |
| version number further as FreeMarker is updated, but of course you should always check the list of effects |
| below. Increasing the 2nd or 1st version number possibly mean substantial changes with higher risk of breaking |
| the application, but again, see the list of effects below. |
| |
| <p>The reason it's separate from <a href="../../../freemarker/template/Configuration.html#setIncompatibleImprovements-freemarker.template.Version-"><code>Configuration.setIncompatibleImprovements(Version)</code></a> is that |
| <a href="../../../freemarker/template/ObjectWrapper.html" title="interface in freemarker.template"><code>ObjectWrapper</code></a> objects are often shared among multiple <a href="../../../freemarker/template/Configuration.html" title="class in freemarker.template"><code>Configuration</code></a>-s, so the two version |
| numbers are technically independent. But it's recommended to keep those two version numbers the same. |
| |
| <p>The changes enabled by <code>incompatibleImprovements</code> are: |
| <ul> |
| <li> |
| <p>2.3.0: No changes; this is the starting point, the version used in older projects. |
| </li> |
| <li> |
| <p>2.3.21 (or higher): |
| Several glitches were fixed in <em>overloaded</em> method selection. This usually just gets |
| rid of errors (like ambiguity exceptions and numerical precision loses due to bad overloaded method |
| choices), still, as in some cases the method chosen can be a different one now (that was the point of |
| the reworking after all), it can mean a change in the behavior of the application. The most important |
| change is that the treatment of <code>null</code> arguments were fixed, as earlier they were only seen |
| applicable to parameters of type <code>Object</code>. Now <code>null</code>-s are seen to be applicable to any |
| non-primitive parameters, and among those the one with the most specific type will be preferred (just |
| like in Java), which is hence never the one with the <code>Object</code> parameter type. For more details |
| about overloaded method selection changes see the version history in the FreeMarker Manual. |
| </li> |
| <li> |
| <p>2.3.24 (or higher): |
| <code>Iterator</code>-s were always said to be non-empty when using <code>?has_content</code> and such (i.e., |
| operators that check emptiness without reading any elements). Now an <code>Iterator</code> counts as |
| empty exactly if it has no elements left. (Note that this bug has never affected basic functionality, like |
| <code><#list ...></code>.) |
| </li> |
| <li> |
| <p>2.3.26 (or higher): |
| The default of <a href="../../../freemarker/ext/beans/BeansWrapper.html#getTreatDefaultMethodsAsBeanMembers--"><code>getTreatDefaultMethodsAsBeanMembers()</code></a> changes from <code>false</code> to |
| <code>true</code>. Thus, Java 8 default methods (and the bean properties they define) are exposed, despite that |
| <code>Introspector</code> (the official JavaBeans introspector) ignores them, at least as of Java 8. |
| </li> |
| <li> |
| <p>2.3.27 (or higher): |
| The default of the <a href="../../../freemarker/ext/beans/BeansWrapper.html#setPreferIndexedReadMethod-boolean-"><code>preferIndexedReadMethod</code></a> setting changes |
| from <code>true</code> to <code>false</code>. |
| </li> |
| </ul> |
| |
| <p>Note that the version will be normalized to the lowest version where the same incompatible |
| <a href="../../../freemarker/ext/beans/BeansWrapper.html" title="class in freemarker.ext.beans"><code>BeansWrapper</code></a> improvements were already present, so <a href="../../../freemarker/ext/beans/BeansWrapper.html#getIncompatibleImprovements--"><code>getIncompatibleImprovements()</code></a> might return |
| a lower version than what you have specified.</dd> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>2.3.21</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="BeansWrapper-freemarker.ext.beans.BeansWrapperConfiguration-boolean-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>BeansWrapper</h4> |
| <pre>protected BeansWrapper(<a href="../../../freemarker/ext/beans/BeansWrapperConfiguration.html" title="class in freemarker.ext.beans">BeansWrapperConfiguration</a> bwConf, |
| boolean writeProtected)</pre> |
| <div class="block">Same as <a href="../../../freemarker/ext/beans/BeansWrapper.html#BeansWrapper-freemarker.ext.beans.BeansWrapperConfiguration-boolean-boolean-"><code>BeansWrapper(BeansWrapperConfiguration, boolean, boolean)</code></a> with <code>true</code> |
| <code>finalizeConstruction</code> argument.</div> |
| <dl> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>2.3.21</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="BeansWrapper-freemarker.ext.beans.BeansWrapperConfiguration-boolean-boolean-"> |
| <!-- --> |
| </a> |
| <ul class="blockListLast"> |
| <li class="blockList"> |
| <h4>BeansWrapper</h4> |
| <pre>protected BeansWrapper(<a href="../../../freemarker/ext/beans/BeansWrapperConfiguration.html" title="class in freemarker.ext.beans">BeansWrapperConfiguration</a> bwConf, |
| boolean writeProtected, |
| boolean finalizeConstruction)</pre> |
| <div class="block">Initializes the instance based on the the <a href="../../../freemarker/ext/beans/BeansWrapperConfiguration.html" title="class in freemarker.ext.beans"><code>BeansWrapperConfiguration</code></a> specified.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>writeProtected</code> - Makes the instance's configuration settings read-only via |
| <a href="../../../freemarker/template/utility/WriteProtectable.html#writeProtect--"><code>WriteProtectable.writeProtect()</code></a>; this way it can use the shared class introspection cache.</dd> |
| <dd><code>finalizeConstruction</code> - Decides if the construction is finalized now, or the caller will do some more |
| adjustments on the instance and then call <a href="../../../freemarker/ext/beans/BeansWrapper.html#finalizeConstruction-boolean-"><code>finalizeConstruction(boolean)</code></a> itself.</dd> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>2.3.22</dd> |
| </dl> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| <!-- ============ METHOD DETAIL ========== --> |
| <ul class="blockList"> |
| <li class="blockList"><a name="method.detail"> |
| <!-- --> |
| </a> |
| <h3>Method Detail</h3> |
| <a name="finalizeConstruction-boolean-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>finalizeConstruction</h4> |
| <pre>protected void finalizeConstruction(boolean writeProtected)</pre> |
| <div class="block">Meant to be called after <a href="../../../freemarker/ext/beans/BeansWrapper.html#BeansWrapper-freemarker.ext.beans.BeansWrapperConfiguration-boolean-boolean-"><code>BeansWrapper(BeansWrapperConfiguration, boolean, boolean)</code></a> when |
| its last argument was <code>false</code>; makes the instance read-only if necessary, then registers the model |
| factories in the class introspector. No further changes should be done after calling this, if |
| <code>writeProtected</code> was <code>true</code>.</div> |
| <dl> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>2.3.22</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="writeProtect--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>writeProtect</h4> |
| <pre>public void writeProtect()</pre> |
| <div class="block">Makes the configuration properties (settings) of this <a href="../../../freemarker/ext/beans/BeansWrapper.html" title="class in freemarker.ext.beans"><code>BeansWrapper</code></a> object read-only. As changing them |
| after the object has become visible to multiple threads leads to undefined behavior, it's recommended to call |
| this when you have finished configuring the object. |
| |
| <p>Consider using <a href="../../../freemarker/ext/beans/BeansWrapperBuilder.html" title="class in freemarker.ext.beans"><code>BeansWrapperBuilder</code></a> instead, which gives an instance that's already |
| write protected and also uses some shared caches/pools.</div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Specified by:</span></dt> |
| <dd><code><a href="../../../freemarker/template/utility/WriteProtectable.html#writeProtect--">writeProtect</a></code> in interface <code><a href="../../../freemarker/template/utility/WriteProtectable.html" title="interface in freemarker.template.utility">WriteProtectable</a></code></dd> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>2.3.21</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="isWriteProtected--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>isWriteProtected</h4> |
| <pre>public boolean isWriteProtected()</pre> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Specified by:</span></dt> |
| <dd><code><a href="../../../freemarker/template/utility/WriteProtectable.html#isWriteProtected--">isWriteProtected</a></code> in interface <code><a href="../../../freemarker/template/utility/WriteProtectable.html" title="interface in freemarker.template.utility">WriteProtectable</a></code></dd> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>2.3.21</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="checkModifiable--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>checkModifiable</h4> |
| <pre>protected void checkModifiable()</pre> |
| <div class="block">If this object is already read-only according to <a href="../../../freemarker/template/utility/WriteProtectable.html" title="interface in freemarker.template.utility"><code>WriteProtectable</code></a>, throws <code>IllegalStateException</code>, |
| otherwise does nothing.</div> |
| <dl> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>2.3.21</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="isStrict--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>isStrict</h4> |
| <pre>public boolean isStrict()</pre> |
| <dl> |
| <dt><span class="seeLabel">See Also:</span></dt> |
| <dd><a href="../../../freemarker/ext/beans/BeansWrapper.html#setStrict-boolean-"><code>setStrict(boolean)</code></a></dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="setStrict-boolean-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>setStrict</h4> |
| <pre>public void setStrict(boolean strict)</pre> |
| <div class="block">Specifies if an attempt to read a bean property that doesn't exist in the |
| wrapped object should throw an <a href="../../../freemarker/ext/beans/InvalidPropertyException.html" title="class in freemarker.ext.beans"><code>InvalidPropertyException</code></a>. |
| |
| <p>If this property is <tt>false</tt> (the default) then an attempt to read |
| a missing bean property is the same as reading an existing bean property whose |
| value is <tt>null</tt>. The template can't tell the difference, and thus always |
| can use <tt>?default('something')</tt> and <tt>?exists</tt> and similar built-ins |
| to handle the situation. |
| |
| <p>If this property is <tt>true</tt> then an attempt to read a bean propertly in |
| the template (like <tt>myBean.aProperty</tt>) that doesn't exist in the bean |
| object (as opposed to just holding <tt>null</tt> value) will cause |
| <a href="../../../freemarker/ext/beans/InvalidPropertyException.html" title="class in freemarker.ext.beans"><code>InvalidPropertyException</code></a>, which can't be suppressed in the template |
| (not even with <tt>myBean.noSuchProperty?default('something')</tt>). This way |
| <tt>?default('something')</tt> and <tt>?exists</tt> and similar built-ins can be used to |
| handle existing properties whose value is <tt>null</tt>, without the risk of |
| hiding typos in the property names. Typos will always cause error. But mind you, it |
| goes against the basic approach of FreeMarker, so use this feature only if you really |
| know what you are doing.</div> |
| </li> |
| </ul> |
| <a name="setOuterIdentity-freemarker.template.ObjectWrapper-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>setOuterIdentity</h4> |
| <pre>public void setOuterIdentity(<a href="../../../freemarker/template/ObjectWrapper.html" title="interface in freemarker.template">ObjectWrapper</a> outerIdentity)</pre> |
| <div class="block">When wrapping an object, the BeansWrapper commonly needs to wrap |
| "sub-objects", for example each element in a wrapped collection. |
| Normally it wraps these objects using itself. However, this makes |
| it difficult to delegate to a BeansWrapper as part of a custom |
| aggregate ObjectWrapper. This method lets you set the ObjectWrapper |
| which will be used to wrap the sub-objects.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>outerIdentity</code> - the aggregate ObjectWrapper</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="getOuterIdentity--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getOuterIdentity</h4> |
| <pre>public <a href="../../../freemarker/template/ObjectWrapper.html" title="interface in freemarker.template">ObjectWrapper</a> getOuterIdentity()</pre> |
| <div class="block">By default returns <tt>this</tt>.</div> |
| <dl> |
| <dt><span class="seeLabel">See Also:</span></dt> |
| <dd><a href="../../../freemarker/ext/beans/BeansWrapper.html#setOuterIdentity-freemarker.template.ObjectWrapper-"><code>setOuterIdentity(ObjectWrapper)</code></a></dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="setSimpleMapWrapper-boolean-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>setSimpleMapWrapper</h4> |
| <pre>public void setSimpleMapWrapper(boolean simpleMapWrapper)</pre> |
| <div class="block">When set to <code>true</code>, the keys in <code>Map</code>-s won't mix with the method names when looking at them |
| from templates. The default is <code>false</code> for backward-compatibility, but is not recommended. |
| |
| <p>When this is <code>false</code>, <code>myMap.foo</code> or <code>myMap['foo']</code> either returns the method <code>foo</code>, |
| or calls <code>Map.get("foo")</code>. If both exists (the method and the <code>Map</code> key), one will hide the other, |
| depending on the <a href="../../../freemarker/ext/beans/BeansWrapper.html#isMethodsShadowItems--"><code>isMethodsShadowItems()</code></a>, which default to <code>true</code> (the method |
| wins). Some frameworks use this so that you can call <code>myMap.get(nonStringKey)</code> from templates [*], but it |
| comes on the cost of polluting the key-set with the method names, and risking methods accidentally hiding |
| <code>Map</code> entries (or the other way around). Thus, this setup is not recommended. |
| (Technical note: <code>Map</code>-s will be wrapped into <a href="../../../freemarker/ext/beans/MapModel.html" title="class in freemarker.ext.beans"><code>MapModel</code></a> in this case.) |
| |
| <p>When this is <code>true</code>, <code>myMap.foo</code> or <code>myMap['foo']</code> always calls <code>Map.get("foo")</code>. |
| The methods of the <code>Map</code> object aren't visible from templates in this case. This, however, spoils the |
| <code>myMap.get(nonStringKey)</code> workaround. But now you can use <code>myMap(nonStringKey)</code> instead, that is, you |
| can use the map itself as the <code>get</code> method. |
| (Technical note: <code>Map</code>-s will be wrapped into <a href="../../../freemarker/ext/beans/SimpleMapModel.html" title="class in freemarker.ext.beans"><code>SimpleMapModel</code></a> in this case.) |
| |
| <p>*: For historical reasons, FreeMarker 2.3.X doesn't support non-string keys with the <code>[]</code> operator, |
| hence the workarounds. This will be likely fixed in FreeMarker 2.4.0. Also note that the method- and |
| the "field"-namespaces aren't separate in FreeMarker, hence <code>myMap.get</code> can return the <code>get</code> |
| method.</div> |
| </li> |
| </ul> |
| <a name="isSimpleMapWrapper--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>isSimpleMapWrapper</h4> |
| <pre>public boolean isSimpleMapWrapper()</pre> |
| <div class="block">Tells whether Maps are exposed as simple maps, without access to their |
| method. See <a href="../../../freemarker/ext/beans/BeansWrapper.html#setSimpleMapWrapper-boolean-"><code>setSimpleMapWrapper(boolean)</code></a> for details.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>true if Maps are exposed as simple hashes, false if they're |
| exposed as full JavaBeans.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="getPreferIndexedReadMethod--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getPreferIndexedReadMethod</h4> |
| <pre>public boolean getPreferIndexedReadMethod()</pre> |
| <div class="block">Getter pair of <a href="../../../freemarker/ext/beans/BeansWrapper.html#setPreferIndexedReadMethod-boolean-"><code>setPreferIndexedReadMethod(boolean)</code></a></div> |
| <dl> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>2.3.27</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="setPreferIndexedReadMethod-boolean-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>setPreferIndexedReadMethod</h4> |
| <pre>public void setPreferIndexedReadMethod(boolean preferIndexedReadMethod)</pre> |
| <div class="block">Sets if when a JavaBean property has both a normal read method (like <code>String[] getFoos()</code>) and an indexed |
| read method (like <code>String getFoos(int index)</code>), and the Java <code>Introspector</code> exposes both (which only |
| happens since Java 8, apparently), which read method will be used when the property is accessed with the |
| shorthand syntax (like <code>myObj.foos</code>). Before <a href="../../../freemarker/ext/beans/BeansWrapper.html#getIncompatibleImprovements--"><code>incompatibleImprovements</code></a> |
| 2.3.27 it defaults to <code>true</code> for backward compatibility (although it's actually less backward compatible if |
| you are just switching to Java 8; see later), but the recommended value and the default starting with |
| <a href="../../../freemarker/ext/beans/BeansWrapper.html#getIncompatibleImprovements--"><code>incompatibleImprovements</code></a> 2.3.27 is <code>false</code>. This setting has no |
| effect on properties that only has normal read method, or only has indexed read method. In case a property has |
| both, using the indexed reader method is disadvantageous, as then FreeMarker can't tell what the highest allowed |
| index is, and so the property will be unlistable (<code><#list foo as myObj.foos></code> will fail). |
| |
| <p> |
| Apparently, this setting only matters since Java 8, as before that <code>Introspector</code> did not expose the |
| indexed reader method if there was also a normal reader method. As with Java 8 the behavior of |
| <code>Introspector</code> has changed, some old templates started to break, as the property has suddenly become |
| unlistable (see earlier why). So setting this to <code>false</code> can be seen as a Java 8 compatibility fix.</div> |
| <dl> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>2.3.27</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="setExposureLevel-int-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>setExposureLevel</h4> |
| <pre>public void setExposureLevel(int exposureLevel)</pre> |
| <div class="block">Sets the method exposure level. By default, set to <code>EXPOSE_SAFE</code>.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>exposureLevel</code> - can be any of the <code>EXPOSE_xxx</code> |
| constants.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="getExposureLevel--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getExposureLevel</h4> |
| <pre>public int getExposureLevel()</pre> |
| <dl> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>2.3.21</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="setExposeFields-boolean-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>setExposeFields</h4> |
| <pre>public void setExposeFields(boolean exposeFields)</pre> |
| <div class="block">Controls whether public instance fields of classes are exposed to |
| templates.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>exposeFields</code> - if set to true, public instance fields of classes |
| that do not have a property getter defined can be accessed directly by |
| their name. If there is a property getter for a property of the same |
| name as the field (i.e. getter "getFoo()" and field "foo"), then |
| referring to "foo" in template invokes the getter. If set to false, no |
| access to public instance fields of classes is given. Default is false.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="setTreatDefaultMethodsAsBeanMembers-boolean-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>setTreatDefaultMethodsAsBeanMembers</h4> |
| <pre>public void setTreatDefaultMethodsAsBeanMembers(boolean treatDefaultMethodsAsBeanMembers)</pre> |
| <div class="block">Controls whether Java 8 default methods that weren't overridden in a class will be recognized as bean property |
| accessors and/or bean actions, and thus will be visible from templates. (We expose bean properties and bean |
| actions, not methods in general.) Before <a href="../../../freemarker/ext/beans/BeansWrapper.html#getIncompatibleImprovements--"><code>incompatibleImprovements</code></a> 2.3.26 |
| this defaults to <code>false</code> for backward compatibility. Starting with <a href="../../../freemarker/ext/beans/BeansWrapper.html#getIncompatibleImprovements--"><code>incompatibleImprovements</code></a> 2.3.26 it defaults to <code>true</code>. |
| <p> |
| Some explanation: FreeMarker uses <code>Introspector</code> to discover the bean properties and actions of |
| classes, for maximum conformance to the JavaBeans specification. But for some reason (perhaps just a bug in the |
| Oracle/OpenJDK Java 8 implementation) that ignores the Java 8 default methods coming from the interfaces. When |
| this setting is <code>true</code>, we search for non-overridden default methods ourselves, and add them to the set of |
| discovered bean members.</div> |
| <dl> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>2.3.26</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="isExposeFields--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>isExposeFields</h4> |
| <pre>public boolean isExposeFields()</pre> |
| <div class="block">Returns whether exposure of public instance fields of classes is |
| enabled. See <a href="../../../freemarker/ext/beans/BeansWrapper.html#setExposeFields-boolean-"><code>setExposeFields(boolean)</code></a> for details.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>true if public instance fields are exposed, false otherwise.</dd> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>2.3.26</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="getTreatDefaultMethodsAsBeanMembers--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getTreatDefaultMethodsAsBeanMembers</h4> |
| <pre>public boolean getTreatDefaultMethodsAsBeanMembers()</pre> |
| <div class="block">See <a href="../../../freemarker/ext/beans/BeansWrapper.html#setTreatDefaultMethodsAsBeanMembers-boolean-"><code>setTreatDefaultMethodsAsBeanMembers(boolean)</code></a>.</div> |
| </li> |
| </ul> |
| <a name="getMethodAppearanceFineTuner--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getMethodAppearanceFineTuner</h4> |
| <pre>public <a href="../../../freemarker/ext/beans/MethodAppearanceFineTuner.html" title="interface in freemarker.ext.beans">MethodAppearanceFineTuner</a> getMethodAppearanceFineTuner()</pre> |
| </li> |
| </ul> |
| <a name="setMethodAppearanceFineTuner-freemarker.ext.beans.MethodAppearanceFineTuner-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>setMethodAppearanceFineTuner</h4> |
| <pre>public void setMethodAppearanceFineTuner(<a href="../../../freemarker/ext/beans/MethodAppearanceFineTuner.html" title="interface in freemarker.ext.beans">MethodAppearanceFineTuner</a> methodAppearanceFineTuner)</pre> |
| <div class="block">Used to tweak certain aspects of how methods appear in the data-model; |
| see <a href="../../../freemarker/ext/beans/MethodAppearanceFineTuner.html" title="interface in freemarker.ext.beans"><code>MethodAppearanceFineTuner</code></a> for more.</div> |
| </li> |
| </ul> |
| <a name="getMemberAccessPolicy--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getMemberAccessPolicy</h4> |
| <pre>public <a href="../../../freemarker/ext/beans/MemberAccessPolicy.html" title="interface in freemarker.ext.beans">MemberAccessPolicy</a> getMemberAccessPolicy()</pre> |
| <dl> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>2.3.30</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="setMemberAccessPolicy-freemarker.ext.beans.MemberAccessPolicy-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>setMemberAccessPolicy</h4> |
| <pre>public void setMemberAccessPolicy(<a href="../../../freemarker/ext/beans/MemberAccessPolicy.html" title="interface in freemarker.ext.beans">MemberAccessPolicy</a> memberAccessPolicy)</pre> |
| <div class="block">Sets the <a href="../../../freemarker/ext/beans/MemberAccessPolicy.html" title="interface in freemarker.ext.beans"><code>MemberAccessPolicy</code></a>; default is <a href="../../../freemarker/ext/beans/DefaultMemberAccessPolicy.html#getInstance-freemarker.template.Version-"><code>DefaultMemberAccessPolicy.getInstance(Version)</code></a>, which |
| is not appropriate if template editors aren't trusted.</div> |
| <dl> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>2.3.30</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="isClassIntrospectionCacheRestricted--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>isClassIntrospectionCacheRestricted</h4> |
| <pre>public boolean isClassIntrospectionCacheRestricted()</pre> |
| <div class="block">Tells if this instance acts like if its class introspection cache is sharable with other <a href="../../../freemarker/ext/beans/BeansWrapper.html" title="class in freemarker.ext.beans"><code>BeansWrapper</code></a>-s. |
| A restricted cache denies certain too "antisocial" operations, like <a href="../../../freemarker/ext/beans/BeansWrapper.html#clearClassIntrospectionCache--"><code>clearClassIntrospectionCache()</code></a>. |
| The value depends on how the instance |
| was created; with a public constructor (then this is <code>false</code>), or with <a href="../../../freemarker/ext/beans/BeansWrapperBuilder.html" title="class in freemarker.ext.beans"><code>BeansWrapperBuilder</code></a> |
| (then it's <code>true</code>). Note that in the last case it's possible that the introspection cache |
| will not be actually shared because there's no one to share with, but this will <code>true</code> even then.</div> |
| <dl> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>2.3.21</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="setMethodsShadowItems-boolean-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>setMethodsShadowItems</h4> |
| <pre>public void setMethodsShadowItems(boolean methodsShadowItems)</pre> |
| <div class="block">Sets whether methods shadow items in beans. When true (this is the |
| default value), <code>${object.name}</code> will first try to locate |
| a bean method or property with the specified name on the object, and |
| only if it doesn't find it will it try to call |
| <code>object.get(name)</code>, the so-called "generic get method" that |
| is usually used to access items of a container (i.e. elements of a map). |
| When set to false, the lookup order is reversed and generic get method |
| is called first, and only if it returns null is method lookup attempted.</div> |
| </li> |
| </ul> |
| <a name="setDefaultDateType-int-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>setDefaultDateType</h4> |
| <pre>public void setDefaultDateType(int defaultDateType)</pre> |
| <div class="block">Sets the default date type to use for date models that result from |
| a plain <tt>java.util.Date</tt> instead of <tt>java.sql.Date</tt> or |
| <tt>java.sql.Time</tt> or <tt>java.sql.Timestamp</tt>. Default value is |
| <a href="../../../freemarker/template/TemplateDateModel.html#UNKNOWN"><code>TemplateDateModel.UNKNOWN</code></a>.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>defaultDateType</code> - the new default date type.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="getDefaultDateType--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getDefaultDateType</h4> |
| <pre>public int getDefaultDateType()</pre> |
| <div class="block">Returns the default date type. See <a href="../../../freemarker/ext/beans/BeansWrapper.html#setDefaultDateType-int-"><code>setDefaultDateType(int)</code></a> for |
| details.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the default date type</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="setUseCache-boolean-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>setUseCache</h4> |
| <pre>public void setUseCache(boolean useCache)</pre> |
| <div class="block">Sets whether this wrapper caches the <a href="../../../freemarker/template/TemplateModel.html" title="interface in freemarker.template"><code>TemplateModel</code></a>-s created for the Java objects that has wrapped with |
| this object wrapper. Default is <code>false</code>. |
| When set to <code>true</code>, calling <a href="../../../freemarker/ext/beans/BeansWrapper.html#wrap-java.lang.Object-"><code>wrap(Object)</code></a> multiple times for |
| the same object will likely return the same model (although there is |
| no guarantee as the cache items can be cleared any time).</div> |
| </li> |
| </ul> |
| <a name="getUseCache--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getUseCache</h4> |
| <pre>public boolean getUseCache()</pre> |
| <dl> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>2.3.21</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="setNullModel-freemarker.template.TemplateModel-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>setNullModel</h4> |
| <pre>@Deprecated |
| public void setNullModel(<a href="../../../freemarker/template/TemplateModel.html" title="interface in freemarker.template">TemplateModel</a> nullModel)</pre> |
| <div class="block"><span class="deprecatedLabel">Deprecated.</span> <span class="deprecationComment">Changing the <code>null</code> model can cause a lot of confusion; don't do it.</span></div> |
| <div class="block">Sets the null model. This model is returned from the <a href="../../../freemarker/ext/beans/BeansWrapper.html#wrap-java.lang.Object-"><code>wrap(Object)</code></a> method whenever the wrapped object is |
| <code>null</code>. It defaults to <code>null</code>, which is dealt with quite strictly on engine level, however you can |
| substitute an arbitrary (perhaps more lenient) model, like an empty string. For proper working, the |
| <code>nullModel</code> should be an <a href="../../../freemarker/template/AdapterTemplateModel.html" title="interface in freemarker.template"><code>AdapterTemplateModel</code></a> that returns <code>null</code> for |
| <a href="../../../freemarker/template/AdapterTemplateModel.html#getAdaptedObject-java.lang.Class-"><code>AdapterTemplateModel.getAdaptedObject(Class)</code></a>.</div> |
| </li> |
| </ul> |
| <a name="getIncompatibleImprovements--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getIncompatibleImprovements</h4> |
| <pre>public <a href="../../../freemarker/template/Version.html" title="class in freemarker.template">Version</a> getIncompatibleImprovements()</pre> |
| <div class="block">Returns the version given with <a href="../../../freemarker/ext/beans/BeansWrapper.html#BeansWrapper-freemarker.template.Version-"><code>BeansWrapper(Version)</code></a>, normalized to the lowest version where a change |
| has occurred. Thus, this is not necessarily the same version than that was given to the constructor.</div> |
| <dl> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>2.3.21</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="normalizeIncompatibleImprovementsVersion-freemarker.template.Version-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>normalizeIncompatibleImprovementsVersion</h4> |
| <pre>protected static <a href="../../../freemarker/template/Version.html" title="class in freemarker.template">Version</a> normalizeIncompatibleImprovementsVersion(<a href="../../../freemarker/template/Version.html" title="class in freemarker.template">Version</a> incompatibleImprovements)</pre> |
| <div class="block">Returns the lowest version number that is equivalent with the parameter version.</div> |
| <dl> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>2.3.21</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="getDefaultInstance--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getDefaultInstance</h4> |
| <pre>@Deprecated |
| public static final <a href="../../../freemarker/ext/beans/BeansWrapper.html" title="class in freemarker.ext.beans">BeansWrapper</a> getDefaultInstance()</pre> |
| <div class="block"><span class="deprecatedLabel">Deprecated.</span> <span class="deprecationComment">Use <a href="../../../freemarker/ext/beans/BeansWrapperBuilder.html" title="class in freemarker.ext.beans"><code>BeansWrapperBuilder</code></a> instead. The instance returned here is not read-only, so it's |
| dangerous to use.</span></div> |
| <div class="block">Returns the default instance of the wrapper. This instance is used |
| when you construct various bean models without explicitly specifying |
| a wrapper. It is also returned by |
| <a href="../../../freemarker/template/ObjectWrapper.html#BEANS_WRAPPER"><code>ObjectWrapper.BEANS_WRAPPER</code></a> |
| and this is the sole instance that is used by the JSP adapter. |
| You can modify the properties of the default instance (caching, |
| exposure level, null model) to affect its operation. By default, the |
| default instance is not caching, uses the <code>EXPOSE_SAFE</code> |
| exposure level, and uses null reference as the null model.</div> |
| </li> |
| </ul> |
| <a name="wrap-java.lang.Object-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>wrap</h4> |
| <pre>public <a href="../../../freemarker/template/TemplateModel.html" title="interface in freemarker.template">TemplateModel</a> wrap(java.lang.Object object) |
| throws <a href="../../../freemarker/template/TemplateModelException.html" title="class in freemarker.template">TemplateModelException</a></pre> |
| <div class="block">Wraps the object with a template model that is most specific for the object's |
| class. Specifically: |
| <ul> |
| <li>if the object is null, returns the <a href="../../../freemarker/ext/beans/BeansWrapper.html#setNullModel-freemarker.template.TemplateModel-"><code>null model</code></a>,</li> |
| <li>if the object is a Number returns a <a href="../../../freemarker/ext/beans/NumberModel.html" title="class in freemarker.ext.beans"><code>NumberModel</code></a> for it,</li> |
| <li>if the object is a Date returns a <a href="../../../freemarker/ext/beans/DateModel.html" title="class in freemarker.ext.beans"><code>DateModel</code></a> for it,</li> |
| <li>if the object is a Boolean returns |
| <a href="../../../freemarker/template/TemplateBooleanModel.html#TRUE"><code>TemplateBooleanModel.TRUE</code></a> or |
| <a href="../../../freemarker/template/TemplateBooleanModel.html#FALSE"><code>TemplateBooleanModel.FALSE</code></a></li> |
| <li>if the object is already a TemplateModel, returns it unchanged,</li> |
| <li>if the object is an array, returns a <a href="../../../freemarker/ext/beans/ArrayModel.html" title="class in freemarker.ext.beans"><code>ArrayModel</code></a> for it |
| <li>if the object is a Map, returns a <a href="../../../freemarker/ext/beans/MapModel.html" title="class in freemarker.ext.beans"><code>MapModel</code></a> for it |
| <li>if the object is a Collection, returns a <a href="../../../freemarker/ext/beans/CollectionModel.html" title="class in freemarker.ext.beans"><code>CollectionModel</code></a> for it |
| <li>if the object is an Iterator, returns a <a href="../../../freemarker/ext/beans/IteratorModel.html" title="class in freemarker.ext.beans"><code>IteratorModel</code></a> for it |
| <li>if the object is an Enumeration, returns a <a href="../../../freemarker/ext/beans/EnumerationModel.html" title="class in freemarker.ext.beans"><code>EnumerationModel</code></a> for it |
| <li>if the object is a String, returns a <a href="../../../freemarker/ext/beans/StringModel.html" title="class in freemarker.ext.beans"><code>StringModel</code></a> for it |
| <li>otherwise, returns a generic <a href="../../../freemarker/ext/beans/StringModel.html" title="class in freemarker.ext.beans"><code>StringModel</code></a> for it. |
| </ul></div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Specified by:</span></dt> |
| <dd><code><a href="../../../freemarker/template/ObjectWrapper.html#wrap-java.lang.Object-">wrap</a></code> in interface <code><a href="../../../freemarker/template/ObjectWrapper.html" title="interface in freemarker.template">ObjectWrapper</a></code></dd> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>object</code> - The object to wrap into a <a href="../../../freemarker/template/TemplateModel.html" title="interface in freemarker.template"><code>TemplateModel</code></a>. If it already implements <a href="../../../freemarker/template/TemplateModel.html" title="interface in freemarker.template"><code>TemplateModel</code></a>, |
| it should just return the object as is. If it's <code>null</code>, the method should return <code>null</code> |
| (however, <a href="../../../freemarker/ext/beans/BeansWrapper.html" title="class in freemarker.ext.beans"><code>BeansWrapper</code></a>, has a legacy option for returning a null model object instead, but it's not |
| a good idea).</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>a <a href="../../../freemarker/template/TemplateModel.html" title="interface in freemarker.template"><code>TemplateModel</code></a> wrapper of the object passed in. To support un-wrapping, you may consider the |
| return value to implement <a href="../../../freemarker/ext/util/WrapperTemplateModel.html" title="interface in freemarker.ext.util"><code>WrapperTemplateModel</code></a> and <a href="../../../freemarker/template/AdapterTemplateModel.html" title="interface in freemarker.template"><code>AdapterTemplateModel</code></a>. |
| The default expectation is that the <a href="../../../freemarker/template/TemplateModel.html" title="interface in freemarker.template"><code>TemplateModel</code></a> isn't less thread safe than the wrapped object. |
| If the <a href="../../../freemarker/template/ObjectWrapper.html" title="interface in freemarker.template"><code>ObjectWrapper</code></a> returns less thread safe objects, that should be clearly documented, as it |
| restricts how it can be used, like, then it can't be used to wrap "shared variables" |
| (<a href="../../../freemarker/template/Configuration.html#setSharedVaribles-java.util.Map-"><code>Configuration.setSharedVaribles(Map)</code></a>).</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="../../../freemarker/template/TemplateModelException.html" title="class in freemarker.template">TemplateModelException</a></code></dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="wrap-java.lang.Object-java.lang.reflect.Method-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>wrap</h4> |
| <pre>public <a href="../../../freemarker/template/TemplateMethodModelEx.html" title="interface in freemarker.template">TemplateMethodModelEx</a> wrap(java.lang.Object object, |
| java.lang.reflect.Method method)</pre> |
| <div class="block">Wraps a Java method so that it can be called from templates, without wrapping its parent ("this") object. The |
| result is almost the same as that you would get by wrapping the parent object then getting the method from the |
| resulting <a href="../../../freemarker/template/TemplateHashModel.html" title="interface in freemarker.template"><code>TemplateHashModel</code></a> by name. Except, if the wrapped method is overloaded, with this method you |
| explicitly select an overload, while otherwise you would get a <a href="../../../freemarker/template/TemplateMethodModelEx.html" title="interface in freemarker.template"><code>TemplateMethodModelEx</code></a> that selects an |
| overload each time it's called based on the argument values.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>object</code> - The object whose method will be called, or <code>null</code> if <code>method</code> is a static method. |
| This object will be used "as is", like without unwrapping it if it's a <a href="../../../freemarker/template/TemplateModelAdapter.html" title="interface in freemarker.template"><code>TemplateModelAdapter</code></a>.</dd> |
| <dd><code>method</code> - The method to call, which must be an (inherited) member of the class of <code>object</code>, as |
| described by <code>Method.invoke(Object, Object...)</code></dd> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>2.3.22</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="wrapAsAPI-java.lang.Object-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>wrapAsAPI</h4> |
| <pre>public <a href="../../../freemarker/template/TemplateHashModel.html" title="interface in freemarker.template">TemplateHashModel</a> wrapAsAPI(java.lang.Object obj) |
| throws <a href="../../../freemarker/template/TemplateModelException.html" title="class in freemarker.template">TemplateModelException</a></pre> |
| <div class="block"><span class="descfrmTypeLabel">Description copied from interface: <code><a href="../../../freemarker/template/utility/ObjectWrapperWithAPISupport.html#wrapAsAPI-java.lang.Object-">ObjectWrapperWithAPISupport</a></code></span></div> |
| <div class="block">Wraps an object to a <a href="../../../freemarker/template/TemplateModel.html" title="interface in freemarker.template"><code>TemplateModel</code></a> that exposes the object's "native" (usually, Java) API.</div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Specified by:</span></dt> |
| <dd><code><a href="../../../freemarker/template/utility/ObjectWrapperWithAPISupport.html#wrapAsAPI-java.lang.Object-">wrapAsAPI</a></code> in interface <code><a href="../../../freemarker/template/utility/ObjectWrapperWithAPISupport.html" title="interface in freemarker.template.utility">ObjectWrapperWithAPISupport</a></code></dd> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>obj</code> - The object for which the API model has to be returned. Shouldn't be <code>null</code>.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>The <a href="../../../freemarker/template/TemplateModel.html" title="interface in freemarker.template"><code>TemplateModel</code></a> through which the API of the object can be accessed. Can't be <code>null</code>.</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="../../../freemarker/template/TemplateModelException.html" title="class in freemarker.template">TemplateModelException</a></code></dd> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>2.3.22</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="getInstance-java.lang.Object-freemarker.ext.util.ModelFactory-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getInstance</h4> |
| <pre>@Deprecated |
| protected <a href="../../../freemarker/template/TemplateModel.html" title="interface in freemarker.template">TemplateModel</a> getInstance(java.lang.Object object, |
| <a href="../../../freemarker/ext/util/ModelFactory.html" title="interface in freemarker.ext.util">ModelFactory</a> factory)</pre> |
| <div class="block"><span class="deprecatedLabel">Deprecated.</span> <span class="deprecationComment">override <a href="../../../freemarker/ext/beans/BeansWrapper.html#getModelFactory-java.lang.Class-"><code>getModelFactory(Class)</code></a> instead. Using this |
| method will now bypass wrapper caching (if it's enabled) and always |
| result in creation of a new wrapper. This method will be removed in 2.4</span></div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>object</code> - The object to wrap</dd> |
| <dd><code>factory</code> - The factory that wraps the object</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="getModelFactory-java.lang.Class-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getModelFactory</h4> |
| <pre>protected <a href="../../../freemarker/ext/util/ModelFactory.html" title="interface in freemarker.ext.util">ModelFactory</a> getModelFactory(java.lang.Class<?> clazz)</pre> |
| </li> |
| </ul> |
| <a name="unwrap-freemarker.template.TemplateModel-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>unwrap</h4> |
| <pre>public java.lang.Object unwrap(<a href="../../../freemarker/template/TemplateModel.html" title="interface in freemarker.template">TemplateModel</a> model) |
| throws <a href="../../../freemarker/template/TemplateModelException.html" title="class in freemarker.template">TemplateModelException</a></pre> |
| <div class="block">Attempts to unwrap a model into underlying object. Generally, this |
| method is the inverse of the <a href="../../../freemarker/ext/beans/BeansWrapper.html#wrap-java.lang.Object-"><code>wrap(Object)</code></a> method. In addition |
| it will unwrap arbitrary <a href="../../../freemarker/template/TemplateNumberModel.html" title="interface in freemarker.template"><code>TemplateNumberModel</code></a> instances into |
| a number, arbitrary <a href="../../../freemarker/template/TemplateDateModel.html" title="interface in freemarker.template"><code>TemplateDateModel</code></a> instances into a date, |
| <a href="../../../freemarker/template/TemplateScalarModel.html" title="interface in freemarker.template"><code>TemplateScalarModel</code></a> instances into a String, arbitrary |
| <a href="../../../freemarker/template/TemplateBooleanModel.html" title="interface in freemarker.template"><code>TemplateBooleanModel</code></a> instances into a Boolean, arbitrary |
| <a href="../../../freemarker/template/TemplateHashModel.html" title="interface in freemarker.template"><code>TemplateHashModel</code></a> instances into a Map, arbitrary |
| <a href="../../../freemarker/template/TemplateSequenceModel.html" title="interface in freemarker.template"><code>TemplateSequenceModel</code></a> into a List, and arbitrary |
| <a href="../../../freemarker/template/TemplateCollectionModel.html" title="interface in freemarker.template"><code>TemplateCollectionModel</code></a> into a Set. All other objects are |
| returned unchanged.</div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Specified by:</span></dt> |
| <dd><code><a href="../../../freemarker/template/ObjectWrapperAndUnwrapper.html#unwrap-freemarker.template.TemplateModel-">unwrap</a></code> in interface <code><a href="../../../freemarker/template/ObjectWrapperAndUnwrapper.html" title="interface in freemarker.template">ObjectWrapperAndUnwrapper</a></code></dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>The plain Java object. Can be <code>null</code>, if <code>null</code> is the appropriate Java value to represent |
| the template model. <code>null</code> must not be used to indicate an unwrapping failure. It must NOT be |
| <a href="../../../freemarker/template/ObjectWrapperAndUnwrapper.html#CANT_UNWRAP_TO_TARGET_CLASS"><code>ObjectWrapperAndUnwrapper.CANT_UNWRAP_TO_TARGET_CLASS</code></a>.</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="../../../freemarker/template/TemplateModelException.html" title="class in freemarker.template">TemplateModelException</a></code> - if an attempted unwrapping fails.</dd> |
| <dt><span class="seeLabel">See Also:</span></dt> |
| <dd><a href="../../../freemarker/template/ObjectWrapperAndUnwrapper.html#tryUnwrapTo-freemarker.template.TemplateModel-java.lang.Class-"><code>ObjectWrapperAndUnwrapper.tryUnwrapTo(TemplateModel, Class)</code></a></dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="unwrap-freemarker.template.TemplateModel-java.lang.Class-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>unwrap</h4> |
| <pre>public java.lang.Object unwrap(<a href="../../../freemarker/template/TemplateModel.html" title="interface in freemarker.template">TemplateModel</a> model, |
| java.lang.Class<?> targetClass) |
| throws <a href="../../../freemarker/template/TemplateModelException.html" title="class in freemarker.template">TemplateModelException</a></pre> |
| <div class="block">Attempts to unwrap a model into an object of the desired class. |
| Generally, this method is the inverse of the <a href="../../../freemarker/ext/beans/BeansWrapper.html#wrap-java.lang.Object-"><code>wrap(Object)</code></a> |
| method. It recognizes a wide range of target classes - all Java built-in |
| primitives, primitive wrappers, numbers, dates, sets, lists, maps, and |
| native arrays.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>model</code> - the model to unwrap</dd> |
| <dd><code>targetClass</code> - the class of the unwrapped result; <code>Object.class</code> if we don't know what the expected type is.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the unwrapped result of the desired class</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="../../../freemarker/template/TemplateModelException.html" title="class in freemarker.template">TemplateModelException</a></code> - if an attempted unwrapping fails.</dd> |
| <dt><span class="seeLabel">See Also:</span></dt> |
| <dd><a href="../../../freemarker/ext/beans/BeansWrapper.html#tryUnwrapTo-freemarker.template.TemplateModel-java.lang.Class-"><code>tryUnwrapTo(TemplateModel, Class)</code></a></dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="tryUnwrapTo-freemarker.template.TemplateModel-java.lang.Class-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>tryUnwrapTo</h4> |
| <pre>public java.lang.Object tryUnwrapTo(<a href="../../../freemarker/template/TemplateModel.html" title="interface in freemarker.template">TemplateModel</a> model, |
| java.lang.Class<?> targetClass) |
| throws <a href="../../../freemarker/template/TemplateModelException.html" title="class in freemarker.template">TemplateModelException</a></pre> |
| <div class="block"><span class="descfrmTypeLabel">Description copied from interface: <code><a href="../../../freemarker/template/ObjectWrapperAndUnwrapper.html#tryUnwrapTo-freemarker.template.TemplateModel-java.lang.Class-">ObjectWrapperAndUnwrapper</a></code></span></div> |
| <div class="block">Attempts to unwrap a <a href="../../../freemarker/template/TemplateModel.html" title="interface in freemarker.template"><code>TemplateModel</code></a> to a plain Java object that's the instance of the given class (or is |
| <code>null</code>).</div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Specified by:</span></dt> |
| <dd><code><a href="../../../freemarker/template/ObjectWrapperAndUnwrapper.html#tryUnwrapTo-freemarker.template.TemplateModel-java.lang.Class-">tryUnwrapTo</a></code> in interface <code><a href="../../../freemarker/template/ObjectWrapperAndUnwrapper.html" title="interface in freemarker.template">ObjectWrapperAndUnwrapper</a></code></dd> |
| <dd><code>targetClass</code> - The class that the return value must be an instance of (except when the return value is <code>null</code>). |
| Can't be <code>null</code>; if the caller doesn't care, it should either use {#unwrap(TemplateModel)}, or |
| <code>Object.class</code> as the parameter value.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>The unwrapped value that's either an instance of <code>targetClass</code>, or is <code>null</code> (if <code>null</code> |
| is the appropriate Java value to represent the template model), or is |
| <a href="../../../freemarker/template/ObjectWrapperAndUnwrapper.html#CANT_UNWRAP_TO_TARGET_CLASS"><code>ObjectWrapperAndUnwrapper.CANT_UNWRAP_TO_TARGET_CLASS</code></a> if the unwrapping can't satisfy the <code>targetClass</code> (nor the |
| result can be <code>null</code>). However, <a href="../../../freemarker/template/ObjectWrapperAndUnwrapper.html#CANT_UNWRAP_TO_TARGET_CLASS"><code>ObjectWrapperAndUnwrapper.CANT_UNWRAP_TO_TARGET_CLASS</code></a> must not be returned if the |
| <code>targetClass</code> parameter was <code>Object.class</code>.</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="../../../freemarker/template/TemplateModelException.html" title="class in freemarker.template">TemplateModelException</a></code> - If the unwrapping fails for a reason than doesn't fit the meaning of the |
| <a href="../../../freemarker/template/ObjectWrapperAndUnwrapper.html#CANT_UNWRAP_TO_TARGET_CLASS"><code>ObjectWrapperAndUnwrapper.CANT_UNWRAP_TO_TARGET_CLASS</code></a> return value.</dd> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>2.3.22</dd> |
| <dt><span class="seeLabel">See Also:</span></dt> |
| <dd><a href="../../../freemarker/template/ObjectWrapperAndUnwrapper.html#unwrap-freemarker.template.TemplateModel-"><code>ObjectWrapperAndUnwrapper.unwrap(TemplateModel)</code></a></dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="invokeMethod-java.lang.Object-java.lang.reflect.Method-java.lang.Object:A-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>invokeMethod</h4> |
| <pre>protected <a href="../../../freemarker/template/TemplateModel.html" title="interface in freemarker.template">TemplateModel</a> invokeMethod(java.lang.Object object, |
| java.lang.reflect.Method method, |
| java.lang.Object[] args) |
| throws java.lang.reflect.InvocationTargetException, |
| java.lang.IllegalAccessException, |
| <a href="../../../freemarker/template/TemplateModelException.html" title="class in freemarker.template">TemplateModelException</a></pre> |
| <div class="block">Invokes the specified method, wrapping the return value. All method invocations done in templates should go |
| through this (assuming the target object was wrapped with this <a href="../../../freemarker/template/ObjectWrapper.html" title="interface in freemarker.template"><code>ObjectWrapper</code></a>). |
| |
| <p>This method is protected since 2.3.30; before that it was package private. The intended application of |
| overriding this is monitoring what calls are made from templates. That can be useful to asses what will be needed |
| in a <a href="../../../freemarker/ext/beans/WhitelistMemberAccessPolicy.html" title="class in freemarker.ext.beans"><code>WhitelistMemberAccessPolicy</code></a> for example. Note that <code>Object.toString()</code> calls caused by type |
| conversion (like when you have <code>${myObject}</code>) will not go through here, as they aren't called by the |
| template directly (and aren't called via reflection). On the other hand, <code>${myObject[key]}</code>, |
| if <code>myObject</code> is not a <code>Map</code>, will go through here as a <code>get(String|Object)</code> method call, if |
| there's a such method. |
| |
| <p>If the return value is null, and the return type of the invoked method is void, |
| <a href="../../../freemarker/template/TemplateModel.html#NOTHING"><code>TemplateModel.NOTHING</code></a> is returned.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>object</code> - the object to invoke the method on (<code>null</code> may be null for static methods)</dd> |
| <dd><code>method</code> - the method to invoke</dd> |
| <dd><code>args</code> - the arguments to the method</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the wrapped return value of the method.</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code>java.lang.reflect.InvocationTargetException</code> - if the invoked method threw an exception</dd> |
| <dd><code>java.lang.IllegalAccessException</code> - if the method can't be invoked due to an |
| access restriction.</dd> |
| <dd><code><a href="../../../freemarker/template/TemplateModelException.html" title="class in freemarker.template">TemplateModelException</a></code> - if the return value couldn't be wrapped |
| (this can happen if the wrapper has an outer identity or is subclassed, |
| and the outer identity or the subclass throws an exception. Plain |
| BeansWrapper never throws TemplateModelException).</dd> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>2.3.30</dd> |
| <dt><span class="seeLabel">See Also:</span></dt> |
| <dd><a href="../../../freemarker/ext/beans/BeansWrapper.html#readField-java.lang.Object-java.lang.reflect.Field-"><code>readField(Object, Field)</code></a></dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="readField-java.lang.Object-java.lang.reflect.Field-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>readField</h4> |
| <pre>protected <a href="../../../freemarker/template/TemplateModel.html" title="interface in freemarker.template">TemplateModel</a> readField(java.lang.Object object, |
| java.lang.reflect.Field field) |
| throws java.lang.IllegalAccessException, |
| <a href="../../../freemarker/template/TemplateModelException.html" title="class in freemarker.template">TemplateModelException</a></pre> |
| <div class="block">Reads the specified field, returns its value as <a href="../../../freemarker/template/TemplateModel.html" title="interface in freemarker.template"><code>TemplateModel</code></a>. All field reading done in templates |
| should go through this (assuming the target object was wrapped with this <a href="../../../freemarker/template/ObjectWrapper.html" title="interface in freemarker.template"><code>ObjectWrapper</code></a>). |
| |
| <p>Just like in the case of <a href="../../../freemarker/ext/beans/BeansWrapper.html#invokeMethod-java.lang.Object-java.lang.reflect.Method-java.lang.Object:A-"><code>invokeMethod(Object, Method, Object[])</code></a>, overriding this can be useful if you |
| want to monitor what members are accessed by templates. However, it has the caveat that final field values are |
| possibly cached, so you won't see all reads. Furthermore, at least static models pre-read final fields, so |
| they will be read even if the templates don't read them.</div> |
| <dl> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code>java.lang.IllegalAccessException</code></dd> |
| <dd><code><a href="../../../freemarker/template/TemplateModelException.html" title="class in freemarker.template">TemplateModelException</a></code></dd> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>2.3.30</dd> |
| <dt><span class="seeLabel">See Also:</span></dt> |
| <dd><a href="../../../freemarker/ext/beans/BeansWrapper.html#invokeMethod-java.lang.Object-java.lang.reflect.Method-java.lang.Object:A-"><code>invokeMethod(Object, Method, Object[])</code></a></dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="getStaticModels--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getStaticModels</h4> |
| <pre>public <a href="../../../freemarker/template/TemplateHashModel.html" title="interface in freemarker.template">TemplateHashModel</a> getStaticModels()</pre> |
| <div class="block">Returns a hash model that represents the so-called class static models. |
| Every class static model is itself a hash through which you can call |
| static methods on the specified class. To obtain a static model for a |
| class, get the element of this hash with the fully qualified class name. |
| For example, if you place this hash model inside the root data model |
| under name "statics", you can use i.e. <code>statics["java.lang. |
| System"]. currentTimeMillis()</code> to call the <code>System.currentTimeMillis()</code> method.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>a hash model whose keys are fully qualified class names, and |
| that returns hash models whose elements are the static models of the |
| classes.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="getEnumModels--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getEnumModels</h4> |
| <pre>public <a href="../../../freemarker/template/TemplateHashModel.html" title="interface in freemarker.template">TemplateHashModel</a> getEnumModels()</pre> |
| <div class="block">Returns a hash model that represents the so-called class enum models. |
| Every class' enum model is itself a hash through which you can access |
| enum value declared by the specified class, assuming that class is an |
| enumeration. To obtain an enum model for a class, get the element of this |
| hash with the fully qualified class name. For example, if you place this |
| hash model inside the root data model under name "enums", you can use |
| i.e. <code>enums["java.math.RoundingMode"].UP</code> to access the |
| <code>RoundingMode.UP</code> value.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>a hash model whose keys are fully qualified class names, and |
| that returns hash models whose elements are the enum models of the |
| classes.</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code>java.lang.UnsupportedOperationException</code> - if this method is invoked on a |
| pre-1.5 JRE, as Java enums aren't supported there.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="newInstance-java.lang.Class-java.util.List-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>newInstance</h4> |
| <pre>public java.lang.Object newInstance(java.lang.Class<?> clazz, |
| java.util.List arguments) |
| throws <a href="../../../freemarker/template/TemplateModelException.html" title="class in freemarker.template">TemplateModelException</a></pre> |
| <div class="block">Creates a new instance of the specified class using the method call logic of this object wrapper for calling the |
| constructor. Overloaded constructors and varargs are supported. Only public constructors will be called.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>clazz</code> - The class whose constructor we will call.</dd> |
| <dd><code>arguments</code> - The list of <a href="../../../freemarker/template/TemplateModel.html" title="interface in freemarker.template"><code>TemplateModel</code></a>-s to pass to the constructor after unwrapping them</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>The instance created; it's not wrapped into <a href="../../../freemarker/template/TemplateModel.html" title="interface in freemarker.template"><code>TemplateModel</code></a>.</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="../../../freemarker/template/TemplateModelException.html" title="class in freemarker.template">TemplateModelException</a></code></dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="removeFromClassIntrospectionCache-java.lang.Class-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>removeFromClassIntrospectionCache</h4> |
| <pre>public void removeFromClassIntrospectionCache(java.lang.Class<?> clazz)</pre> |
| <div class="block">Removes the introspection data for a class from the cache. |
| Use this if you know that a class is not used anymore in templates. |
| If the class will be still used, the cache entry will be silently |
| re-created, so this isn't a dangerous operation.</div> |
| <dl> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>2.3.20</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="clearClassIntrospecitonCache--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>clearClassIntrospecitonCache</h4> |
| <pre>@Deprecated |
| public void clearClassIntrospecitonCache()</pre> |
| <div class="block"><span class="deprecatedLabel">Deprecated.</span> <span class="deprecationComment">There's a typo in this method name, so use <a href="../../../freemarker/ext/beans/BeansWrapper.html#clearClassIntrospectionCache--"><code>clearClassIntrospectionCache()</code></a> instead.</span></div> |
| <div class="block"><p>Removes all class introspection data from the cache. |
| |
| <p>Use this if you want to free up memory on the expense of recreating |
| the cache entries for the classes that will be used later in templates.</div> |
| <dl> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code>java.lang.IllegalStateException</code> - if <a href="../../../freemarker/ext/beans/BeansWrapper.html#isClassIntrospectionCacheRestricted--"><code>isClassIntrospectionCacheRestricted()</code></a> is <code>true</code>.</dd> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>2.3.20</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="clearClassIntrospectionCache--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>clearClassIntrospectionCache</h4> |
| <pre>public void clearClassIntrospectionCache()</pre> |
| <div class="block">Removes all class introspection data from the cache. |
| |
| <p>Use this if you want to free up memory on the expense of recreating |
| the cache entries for the classes that will be used later in templates.</div> |
| <dl> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code>java.lang.IllegalStateException</code> - if <a href="../../../freemarker/ext/beans/BeansWrapper.html#isClassIntrospectionCacheRestricted--"><code>isClassIntrospectionCacheRestricted()</code></a> is <code>true</code>.</dd> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>2.3.29 (in earlier versions use <a href="../../../freemarker/ext/beans/BeansWrapper.html#clearClassIntrospecitonCache--"><code>clearClassIntrospecitonCache()</code></a>)</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="finetuneMethodAppearance-java.lang.Class-java.lang.reflect.Method-freemarker.ext.beans.BeansWrapper.MethodAppearanceDecision-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>finetuneMethodAppearance</h4> |
| <pre>@Deprecated |
| protected void finetuneMethodAppearance(java.lang.Class<?> clazz, |
| java.lang.reflect.Method m, |
| <a href="../../../freemarker/ext/beans/BeansWrapper.MethodAppearanceDecision.html" title="class in freemarker.ext.beans">BeansWrapper.MethodAppearanceDecision</a> decision)</pre> |
| <div class="block"><span class="deprecatedLabel">Deprecated.</span> <span class="deprecationComment">Use <a href="../../../freemarker/ext/beans/BeansWrapper.html#setMethodAppearanceFineTuner-freemarker.ext.beans.MethodAppearanceFineTuner-"><code>setMethodAppearanceFineTuner(MethodAppearanceFineTuner)</code></a>; |
| no need to extend this class anymore. |
| Soon this method will be final, so trying to override it will break your app. |
| Note that if the <code>methodAppearanceFineTuner</code> property is set to non-<code>null</code>, this method is not |
| called anymore.</span></div> |
| </li> |
| </ul> |
| <a name="coerceBigDecimals-java.lang.reflect.AccessibleObject-java.lang.Object:A-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>coerceBigDecimals</h4> |
| <pre>public static void coerceBigDecimals(java.lang.reflect.AccessibleObject callable, |
| java.lang.Object[] args)</pre> |
| <div class="block">Converts any <code>BigDecimal</code>s in the passed array to the type of |
| the corresponding formal argument of the method.</div> |
| </li> |
| </ul> |
| <a name="coerceBigDecimals-java.lang.Class:A-java.lang.Object:A-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>coerceBigDecimals</h4> |
| <pre>public static void coerceBigDecimals(java.lang.Class<?>[] formalTypes, |
| java.lang.Object[] args)</pre> |
| <div class="block">Converts any <code>BigDecimal</code>-s in the passed array to the type of |
| the corresponding formal argument of the method via <a href="../../../freemarker/ext/beans/BeansWrapper.html#coerceBigDecimal-java.math.BigDecimal-java.lang.Class-"><code>coerceBigDecimal(BigDecimal, Class)</code></a>.</div> |
| </li> |
| </ul> |
| <a name="coerceBigDecimal-java.math.BigDecimal-java.lang.Class-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>coerceBigDecimal</h4> |
| <pre>public static java.lang.Object coerceBigDecimal(java.math.BigDecimal bd, |
| java.lang.Class<?> formalType)</pre> |
| <div class="block">Converts <code>BigDecimal</code> to the class given in the <code>formalType</code> argument if that's a known numerical |
| type, returns the <code>BigDecimal</code> as is otherwise. Overflow and precision loss are possible, similarly as |
| with casting in Java.</div> |
| </li> |
| </ul> |
| <a name="toString--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>toString</h4> |
| <pre>public java.lang.String toString()</pre> |
| <div class="block">Returns the exact class name and the identity hash, also the values of the most often used <a href="../../../freemarker/ext/beans/BeansWrapper.html" title="class in freemarker.ext.beans"><code>BeansWrapper</code></a> |
| configuration properties, also if which (if any) shared class introspection cache it uses.</div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code>toString</code> in class <code>java.lang.Object</code></dd> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>2.3.21</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="toPropertiesString--"> |
| <!-- --> |
| </a> |
| <ul class="blockListLast"> |
| <li class="blockList"> |
| <h4>toPropertiesString</h4> |
| <pre>protected java.lang.String toPropertiesString()</pre> |
| <div class="block">Returns the name-value pairs that describe the configuration of this <a href="../../../freemarker/ext/beans/BeansWrapper.html" title="class in freemarker.ext.beans"><code>BeansWrapper</code></a>; called from |
| <a href="../../../freemarker/ext/beans/BeansWrapper.html#toString--"><code>toString()</code></a>. The expected format is like <code>"foo=bar, baaz=wombat"</code>. When overriding this, you should |
| call the super method, and then insert the content before it with a following <code>", "</code>, or after it with a |
| preceding <code>", "</code>.</div> |
| <dl> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>2.3.22</dd> |
| </dl> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| </div> |
| </div> |
| <!-- ========= END OF CLASS DATA ========= --> |
| <!-- ======= START OF BOTTOM NAVBAR ====== --> |
| <div class="bottomNav"><a name="navbar.bottom"> |
| <!-- --> |
| </a> |
| <div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div> |
| <a name="navbar.bottom.firstrow"> |
| <!-- --> |
| </a> |
| <ul class="navList" title="Navigation"> |
| <li><a href="../../../overview-summary.html">Overview</a></li> |
| <li><a href="package-summary.html">Package</a></li> |
| <li class="navBarCell1Rev">Class</li> |
| <li><a href="class-use/BeansWrapper.html">Use</a></li> |
| <li><a href="package-tree.html">Tree</a></li> |
| <li><a href="../../../deprecated-list.html">Deprecated</a></li> |
| <li><a href="../../../index-all.html">Index</a></li> |
| <li><a href="../../../help-doc.html">Help</a></li> |
| </ul> |
| </div> |
| <div class="subNav"> |
| <ul class="navList"> |
| <li><a href="../../../freemarker/ext/beans/BeansModelCache.html" title="class in freemarker.ext.beans"><span class="typeNameLink">Prev Class</span></a></li> |
| <li><a href="../../../freemarker/ext/beans/BeansWrapper.MethodAppearanceDecision.html" title="class in freemarker.ext.beans"><span class="typeNameLink">Next Class</span></a></li> |
| </ul> |
| <ul class="navList"> |
| <li><a href="../../../index.html?freemarker/ext/beans/BeansWrapper.html" target="_top">Frames</a></li> |
| <li><a href="BeansWrapper.html" target="_top">No Frames</a></li> |
| </ul> |
| <ul class="navList" id="allclasses_navbar_bottom"> |
| <li><a href="../../../allclasses-noframe.html">All Classes</a></li> |
| </ul> |
| <div> |
| <script type="text/javascript"><!-- |
| allClassesLink = document.getElementById("allclasses_navbar_bottom"); |
| if(window==top) { |
| allClassesLink.style.display = "block"; |
| } |
| else { |
| allClassesLink.style.display = "none"; |
| } |
| //--> |
| </script> |
| </div> |
| <div> |
| <ul class="subNavList"> |
| <li>Summary: </li> |
| <li><a href="#nested.class.summary">Nested</a> | </li> |
| <li><a href="#field.summary">Field</a> | </li> |
| <li><a href="#constructor.summary">Constr</a> | </li> |
| <li><a href="#method.summary">Method</a></li> |
| </ul> |
| <ul class="subNavList"> |
| <li>Detail: </li> |
| <li><a href="#field.detail">Field</a> | </li> |
| <li><a href="#constructor.detail">Constr</a> | </li> |
| <li><a href="#method.detail">Method</a></li> |
| </ul> |
| </div> |
| <a name="skip.navbar.bottom"> |
| <!-- --> |
| </a></div> |
| <!-- ======== END OF BOTTOM NAVBAR ======= --> |
| </body> |
| </html> |