blob: 378c340e586f99e5f8d3bbf72025cc7826fbd37c [file] [log] [blame]
<!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:35 CET 2023 -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>MethodAppearanceFineTuner (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="MethodAppearanceFineTuner (FreeMarker 2.3.32 API)";
}
}
catch(err) {
}
//-->
var methods = {"i0":6};
var tabs = {65535:["t0","All Methods"],2:["t2","Instance Methods"],4:["t3","Abstract 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/MethodAppearanceFineTuner.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/MemberSelectorListMemberAccessPolicy.MemberSelector.html" title="class in freemarker.ext.beans"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
<li><a href="../../../freemarker/ext/beans/NumberModel.html" title="class in freemarker.ext.beans"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../index.html?freemarker/ext/beans/MethodAppearanceFineTuner.html" target="_top">Frames</a></li>
<li><a href="MethodAppearanceFineTuner.html" target="_top">No&nbsp;Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../allclasses-noframe.html">All&nbsp;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:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</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="Interface MethodAppearanceFineTuner" class="title">Interface MethodAppearanceFineTuner</h2>
</div>
<div class="contentContainer">
<div class="description">
<ul class="blockList">
<li class="blockList">
<hr>
<br>
<pre>public interface <span class="typeNameLabel">MethodAppearanceFineTuner</span></pre>
<div class="block">Used for customizing how the methods are visible from templates, via
<a href="../../../freemarker/ext/beans/BeansWrapper.html#setMethodAppearanceFineTuner-freemarker.ext.beans.MethodAppearanceFineTuner-"><code>BeansWrapper.setMethodAppearanceFineTuner(MethodAppearanceFineTuner)</code></a>.
The object that implements this should also implement <a href="../../../freemarker/ext/beans/SingletonCustomizer.html" title="interface in freemarker.ext.beans"><code>SingletonCustomizer</code></a> whenever possible.</div>
<dl>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>2.3.21</dd>
</dl>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- ========== 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">&nbsp;</span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd">&nbsp;</span></span><span id="t3" class="tableTab"><span><a href="javascript:show(4);">Abstract Methods</a></span><span class="tabEnd">&nbsp;</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>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../freemarker/ext/beans/MethodAppearanceFineTuner.html#process-freemarker.ext.beans.BeansWrapper.MethodAppearanceDecisionInput-freemarker.ext.beans.BeansWrapper.MethodAppearanceDecision-">process</a></span>(<a href="../../../freemarker/ext/beans/BeansWrapper.MethodAppearanceDecisionInput.html" title="class in freemarker.ext.beans">BeansWrapper.MethodAppearanceDecisionInput</a>&nbsp;in,
<a href="../../../freemarker/ext/beans/BeansWrapper.MethodAppearanceDecision.html" title="class in freemarker.ext.beans">BeansWrapper.MethodAppearanceDecision</a>&nbsp;out)</code>
<div class="block">Implement this to tweak certain aspects of how methods appear in the
data-model.</div>
</td>
</tr>
</table>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method.detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a name="process-freemarker.ext.beans.BeansWrapper.MethodAppearanceDecisionInput-freemarker.ext.beans.BeansWrapper.MethodAppearanceDecision-">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>process</h4>
<pre>void&nbsp;process(<a href="../../../freemarker/ext/beans/BeansWrapper.MethodAppearanceDecisionInput.html" title="class in freemarker.ext.beans">BeansWrapper.MethodAppearanceDecisionInput</a>&nbsp;in,
<a href="../../../freemarker/ext/beans/BeansWrapper.MethodAppearanceDecision.html" title="class in freemarker.ext.beans">BeansWrapper.MethodAppearanceDecision</a>&nbsp;out)</pre>
<div class="block">Implement this to tweak certain aspects of how methods appear in the
data-model. <a href="../../../freemarker/ext/beans/BeansWrapper.html" title="class in freemarker.ext.beans"><code>BeansWrapper</code></a> will pass in all Java methods here that
it intends to expose in the data-model as methods (so you can do
<tt>obj.foo()</tt> in the template).
With this method you can do the following tweaks:
<ul>
<li>Hide a method that would be otherwise shown by calling
<a href="../../../freemarker/ext/beans/BeansWrapper.MethodAppearanceDecision.html#setExposeMethodAs-java.lang.String-"><code>BeansWrapper.MethodAppearanceDecision.setExposeMethodAs(String)</code></a>
with <tt>null</tt> parameter. Note that you can't un-hide methods
that are not public or are considered to by unsafe
(like <code>Object.wait()</code>) because
<a href="../../../freemarker/ext/beans/MethodAppearanceFineTuner.html#process-freemarker.ext.beans.BeansWrapper.MethodAppearanceDecisionInput-freemarker.ext.beans.BeansWrapper.MethodAppearanceDecision-"><code>process(freemarker.ext.beans.BeansWrapper.MethodAppearanceDecisionInput, freemarker.ext.beans.BeansWrapper.MethodAppearanceDecision)</code></a> is not called for those.</li>
<li>Show the method with a different name in the data-model than its
real name by calling
<a href="../../../freemarker/ext/beans/BeansWrapper.MethodAppearanceDecision.html#setExposeMethodAs-java.lang.String-"><code>BeansWrapper.MethodAppearanceDecision.setExposeMethodAs(String)</code></a>
with non-<tt>null</tt> parameter.
<li>Create a fake JavaBean property for this method by calling
<a href="../../../freemarker/ext/beans/BeansWrapper.MethodAppearanceDecision.html#setExposeAsProperty-java.beans.PropertyDescriptor-"><code>BeansWrapper.MethodAppearanceDecision.setExposeAsProperty(PropertyDescriptor)</code></a>.
For example, if you have <tt>int size()</tt> in a class, but you
want it to be accessed from the templates as <tt>obj.size</tt>,
rather than as <tt>obj.size()</tt>, you can do that with this
(but remember calling
<a href="../../../freemarker/ext/beans/BeansWrapper.MethodAppearanceDecision.html#setMethodShadowsProperty-boolean-"><code>setMethodShadowsProperty(false)</code></a> as well, if the method name is exactly
the same as the property name).
The default is <code>null</code>, which means that no fake property is
created for the method. You need not and shouldn't set this
to non-<tt>null</tt> for the getter methods of real JavaBean
properties, as those are automatically shown as properties anyway.
The property name in the <code>PropertyDescriptor</code> can be anything,
but the method (or methods) in it must belong to the class that
is given as the <tt>clazz</tt> parameter or it must be inherited from
that class, or else whatever errors can occur later.
<code>IndexedPropertyDescriptor</code>-s are supported.
If a real JavaBean property of the same name exists, or a fake property
of the same name was already assigned earlier, it won't be
replaced by the new one by default, however this can be changed with
<a href="../../../freemarker/ext/beans/BeansWrapper.MethodAppearanceDecision.html#setReplaceExistingProperty-boolean-"><code>BeansWrapper.MethodAppearanceDecision.setReplaceExistingProperty(boolean)</code></a>.
<li>Prevent the method to hide a JavaBean property (fake or real) of
the same name by calling
<a href="../../../freemarker/ext/beans/BeansWrapper.MethodAppearanceDecision.html#setMethodShadowsProperty-boolean-"><code>BeansWrapper.MethodAppearanceDecision.setMethodShadowsProperty(boolean)</code></a>
with <tt>false</tt>. The default is <tt>true</tt>, so if you have
both a property and a method called "foo", then in the template
<tt>myObject.foo</tt> will return the method itself instead
of the property value, which is often undesirable.
</ul>
<p>Note that you can expose a Java method both as a method and as a
JavaBean property on the same time, however you have to chose different
names for them to prevent shadowing.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>in</code> - Describes the method about which the decision will have to be made.</dd>
<dd><code>out</code> - Stores how the method will be exposed in the
data-model after <a href="../../../freemarker/ext/beans/MethodAppearanceFineTuner.html#process-freemarker.ext.beans.BeansWrapper.MethodAppearanceDecisionInput-freemarker.ext.beans.BeansWrapper.MethodAppearanceDecision-"><code>process(freemarker.ext.beans.BeansWrapper.MethodAppearanceDecisionInput, freemarker.ext.beans.BeansWrapper.MethodAppearanceDecision)</code></a> returns.
This is initialized so that it reflects the default
behavior of <a href="../../../freemarker/ext/beans/BeansWrapper.html" title="class in freemarker.ext.beans"><code>BeansWrapper</code></a>, so you don't have to do anything with this
when you don't want to change the default behavior.</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/MethodAppearanceFineTuner.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/MemberSelectorListMemberAccessPolicy.MemberSelector.html" title="class in freemarker.ext.beans"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
<li><a href="../../../freemarker/ext/beans/NumberModel.html" title="class in freemarker.ext.beans"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../index.html?freemarker/ext/beans/MethodAppearanceFineTuner.html" target="_top">Frames</a></li>
<li><a href="MethodAppearanceFineTuner.html" target="_top">No&nbsp;Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../allclasses-noframe.html">All&nbsp;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:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a name="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</body>
</html>