| <!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>SimpleHash (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="SimpleHash (FreeMarker 2.3.32 API)"; |
| } |
| } |
| catch(err) { |
| } |
| //--> |
| var methods = {"i0":10,"i1":10,"i2":10,"i3":10,"i4":10,"i5":10,"i6":10,"i7":10,"i8":10,"i9":10,"i10":10,"i11":10,"i12":10,"i13":10,"i14":10}; |
| var tabs = {65535:["t0","All Methods"],2:["t2","Instance Methods"],8:["t4","Concrete 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/SimpleHash.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/template/SimpleDate.html" title="class in freemarker.template"><span class="typeNameLink">Prev Class</span></a></li> |
| <li><a href="../../freemarker/template/SimpleList.html" title="class in freemarker.template"><span class="typeNameLink">Next Class</span></a></li> |
| </ul> |
| <ul class="navList"> |
| <li><a href="../../index.html?freemarker/template/SimpleHash.html" target="_top">Frames</a></li> |
| <li><a href="SimpleHash.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>Nested | </li> |
| <li>Field | </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>Field | </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.template</div> |
| <h2 title="Class SimpleHash" class="title">Class SimpleHash</h2> |
| </div> |
| <div class="contentContainer"> |
| <ul class="inheritance"> |
| <li>java.lang.Object</li> |
| <li> |
| <ul class="inheritance"> |
| <li><a href="../../freemarker/template/WrappingTemplateModel.html" title="class in freemarker.template">freemarker.template.WrappingTemplateModel</a></li> |
| <li> |
| <ul class="inheritance"> |
| <li>freemarker.template.SimpleHash</li> |
| </ul> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| <div class="description"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <dl> |
| <dt>All Implemented Interfaces:</dt> |
| <dd><a href="../../freemarker/template/TemplateHashModel.html" title="interface in freemarker.template">TemplateHashModel</a>, <a href="../../freemarker/template/TemplateHashModelEx.html" title="interface in freemarker.template">TemplateHashModelEx</a>, <a href="../../freemarker/template/TemplateHashModelEx2.html" title="interface in freemarker.template">TemplateHashModelEx2</a>, <a href="../../freemarker/template/TemplateModel.html" title="interface in freemarker.template">TemplateModel</a>, java.io.Serializable</dd> |
| </dl> |
| <dl> |
| <dt>Direct Known Subclasses:</dt> |
| <dd><a href="../../freemarker/ext/servlet/AllHttpScopesHashModel.html" title="class in freemarker.ext.servlet">AllHttpScopesHashModel</a>, <a href="../../freemarker/core/Environment.Namespace.html" title="class in freemarker.core">Environment.Namespace</a></dd> |
| </dl> |
| <hr> |
| <br> |
| <pre>public class <span class="typeNameLabel">SimpleHash</span> |
| extends <a href="../../freemarker/template/WrappingTemplateModel.html" title="class in freemarker.template">WrappingTemplateModel</a> |
| implements <a href="../../freemarker/template/TemplateHashModelEx2.html" title="interface in freemarker.template">TemplateHashModelEx2</a>, java.io.Serializable</pre> |
| <div class="block">A simple implementation of the <a href="../../freemarker/template/TemplateHashModelEx.html" title="interface in freemarker.template"><code>TemplateHashModelEx</code></a> interface, using its own underlying <code>Map</code> or |
| <code>SortedMap</code> for storing the hash entries. If you are wrapping an already existing <code>Map</code>, you should |
| certainly use <a href="../../freemarker/template/DefaultMapAdapter.html" title="class in freemarker.template"><code>DefaultMapAdapter</code></a> instead (see comparison below). |
| |
| <p> |
| This class is thread-safe if you don't call modifying methods (like <a href="../../freemarker/template/SimpleHash.html#put-java.lang.String-java.lang.Object-"><code>put(String, Object)</code></a>, |
| <a href="../../freemarker/template/SimpleHash.html#remove-java.lang.String-"><code>remove(String)</code></a>, etc.) after you have made the object available for multiple threads (assuming you have |
| published it safely to the other threads; see JSR-133 Java Memory Model). These methods aren't called by FreeMarker, |
| so it's usually not a concern. |
| |
| <p> |
| <b><a href="../../freemarker/template/SimpleHash.html" title="class in freemarker.template"><code>SimpleHash</code></a> VS <a href="../../freemarker/template/DefaultMapAdapter.html" title="class in freemarker.template"><code>DefaultMapAdapter</code></a> - Which to use when?</b> |
| |
| <p> |
| For a <code>Map</code> that exists regardless of FreeMarker, only you need to access it from templates, |
| <a href="../../freemarker/template/DefaultMapAdapter.html" title="class in freemarker.template"><code>DefaultMapAdapter</code></a> should be the default choice, as it reflects the exact behavior of the underlying |
| <code>Map</code> (no surprises), can be unwrapped to the originally wrapped object (important when passing it to Java |
| methods from the template), and has more predictable performance (no spikes). |
| |
| <p> |
| For a hash that's made specifically to be used from templates, creating an empty <a href="../../freemarker/template/SimpleHash.html" title="class in freemarker.template"><code>SimpleHash</code></a> then filling it |
| with <a href="../../freemarker/template/SimpleHash.html#put-java.lang.String-java.lang.Object-"><code>put(String, Object)</code></a> is usually the way to go, as the resulting hash is significantly faster |
| to read from templates than a <a href="../../freemarker/template/DefaultMapAdapter.html" title="class in freemarker.template"><code>DefaultMapAdapter</code></a> (though it's somewhat slower to read from a plain Java method |
| to which it had to be passed adapted to a <code>Map</code>). |
| |
| <p> |
| It also matters if for how many times will the <em>same</em> <code>Map</code> entry be read from the template(s) later, on |
| average. If, on average, you read each entry for more than 4 times, <a href="../../freemarker/template/SimpleHash.html" title="class in freemarker.template"><code>SimpleHash</code></a> will be most certainly faster, |
| but if for 2 times or less (and especially if not at all) then <a href="../../freemarker/template/DefaultMapAdapter.html" title="class in freemarker.template"><code>DefaultMapAdapter</code></a> will be faster. Before |
| choosing based on performance though, pay attention to the behavioral differences; <a href="../../freemarker/template/SimpleHash.html" title="class in freemarker.template"><code>SimpleHash</code></a> will |
| shallow-copy the original <code>Map</code> at construction time, so key order will be lost in some cases, and it won't |
| reflect <code>Map</code> content changes after the <a href="../../freemarker/template/SimpleHash.html" title="class in freemarker.template"><code>SimpleHash</code></a> construction, also <a href="../../freemarker/template/SimpleHash.html" title="class in freemarker.template"><code>SimpleHash</code></a> can't be |
| unwrapped to the original <code>Map</code> instance.</div> |
| <dl> |
| <dt><span class="seeLabel">See Also:</span></dt> |
| <dd><a href="../../freemarker/template/DefaultMapAdapter.html" title="class in freemarker.template"><code>DefaultMapAdapter</code></a>, |
| <a href="../../freemarker/template/TemplateHashModelEx.html" title="interface in freemarker.template"><code>TemplateHashModelEx</code></a>, |
| <a href="../../serialized-form.html#freemarker.template.SimpleHash">Serialized Form</a></dd> |
| </dl> |
| </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> |
| <ul class="blockList"> |
| <li class="blockList"><a name="nested.classes.inherited.from.class.freemarker.template.TemplateHashModelEx2"> |
| <!-- --> |
| </a> |
| <h3>Nested classes/interfaces inherited from interface freemarker.template.<a href="../../freemarker/template/TemplateHashModelEx2.html" title="interface in freemarker.template">TemplateHashModelEx2</a></h3> |
| <code><a href="../../freemarker/template/TemplateHashModelEx2.KeyValuePair.html" title="interface in freemarker.template">TemplateHashModelEx2.KeyValuePair</a>, <a href="../../freemarker/template/TemplateHashModelEx2.KeyValuePairIterator.html" title="interface in freemarker.template">TemplateHashModelEx2.KeyValuePairIterator</a></code></li> |
| </ul> |
| </li> |
| </ul> |
| <!-- =========== FIELD SUMMARY =========== --> |
| <ul class="blockList"> |
| <li class="blockList"><a name="field.summary"> |
| <!-- --> |
| </a> |
| <h3>Field Summary</h3> |
| <ul class="blockList"> |
| <li class="blockList"><a name="fields.inherited.from.class.freemarker.template.TemplateModel"> |
| <!-- --> |
| </a> |
| <h3>Fields inherited from interface freemarker.template.<a href="../../freemarker/template/TemplateModel.html" title="interface in freemarker.template">TemplateModel</a></h3> |
| <code><a href="../../freemarker/template/TemplateModel.html#NOTHING">NOTHING</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="colOne" scope="col">Constructor and Description</th> |
| </tr> |
| <tr class="altColor"> |
| <td class="colOne"><code><span class="memberNameLink"><a href="../../freemarker/template/SimpleHash.html#SimpleHash--">SimpleHash</a></span>()</code> |
| <div class="block"><span class="deprecatedLabel">Deprecated.</span> |
| <div class="block"><span class="deprecationComment">Use <a href="../../freemarker/template/SimpleHash.html#SimpleHash-freemarker.template.ObjectWrapper-"><code>SimpleHash(ObjectWrapper)</code></a></span></div> |
| </div> |
| </td> |
| </tr> |
| <tr class="rowColor"> |
| <td class="colOne"><code><span class="memberNameLink"><a href="../../freemarker/template/SimpleHash.html#SimpleHash-java.util.Map-">SimpleHash</a></span>(java.util.Map map)</code> |
| <div class="block"><span class="deprecatedLabel">Deprecated.</span> |
| <div class="block"><span class="deprecationComment">Use <a href="../../freemarker/template/SimpleHash.html#SimpleHash-java.util.Map-freemarker.template.ObjectWrapper-"><code>SimpleHash(Map, ObjectWrapper)</code></a></span></div> |
| </div> |
| </td> |
| </tr> |
| <tr class="altColor"> |
| <td class="colOne"><code><span class="memberNameLink"><a href="../../freemarker/template/SimpleHash.html#SimpleHash-java.util.Map-freemarker.template.ObjectWrapper-int-">SimpleHash</a></span>(java.util.Map<java.lang.String,java.lang.Object> directMap, |
| <a href="../../freemarker/template/ObjectWrapper.html" title="interface in freemarker.template">ObjectWrapper</a> wrapper, |
| int overloadDistinction)</code> |
| <div class="block">Creates an instance that will use the specified <code>Map</code> directly as its backing store; beware, the |
| <code>Map</code> will be possibly modified by <a href="../../freemarker/template/SimpleHash.html" title="class in freemarker.template"><code>SimpleHash</code></a>, even if you only read the <a href="../../freemarker/template/SimpleHash.html" title="class in freemarker.template"><code>SimpleHash</code></a>.</div> |
| </td> |
| </tr> |
| <tr class="rowColor"> |
| <td class="colOne"><code><span class="memberNameLink"><a href="../../freemarker/template/SimpleHash.html#SimpleHash-java.util.Map-freemarker.template.ObjectWrapper-">SimpleHash</a></span>(java.util.Map map, |
| <a href="../../freemarker/template/ObjectWrapper.html" title="interface in freemarker.template">ObjectWrapper</a> wrapper)</code> |
| <div class="block">Creates a new hash by shallow-coping (possibly cloning) the underlying map; in many applications you should use |
| <a href="../../freemarker/template/DefaultMapAdapter.html" title="class in freemarker.template"><code>DefaultMapAdapter</code></a> instead.</div> |
| </td> |
| </tr> |
| <tr class="altColor"> |
| <td class="colOne"><code><span class="memberNameLink"><a href="../../freemarker/template/SimpleHash.html#SimpleHash-freemarker.template.ObjectWrapper-">SimpleHash</a></span>(<a href="../../freemarker/template/ObjectWrapper.html" title="interface in freemarker.template">ObjectWrapper</a> wrapper)</code> |
| <div class="block">Creates an empty simple hash using the specified object wrapper.</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="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></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>boolean</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../freemarker/template/SimpleHash.html#containsKey-java.lang.String-">containsKey</a></span>(java.lang.String key)</code> |
| <div class="block">Tells if the map contains a key or not, regardless if the associated value is <code>null</code> or not.</div> |
| </td> |
| </tr> |
| <tr id="i1" class="rowColor"> |
| <td class="colFirst"><code>protected java.util.Map</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../freemarker/template/SimpleHash.html#copyMap-java.util.Map-">copyMap</a></span>(java.util.Map map)</code> </td> |
| </tr> |
| <tr id="i2" 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/template/SimpleHash.html#get-java.lang.String-">get</a></span>(java.lang.String key)</code> |
| <div class="block">Gets a <tt>TemplateModel</tt> from the hash.</div> |
| </td> |
| </tr> |
| <tr id="i3" class="rowColor"> |
| <td class="colFirst"><code>boolean</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../freemarker/template/SimpleHash.html#isEmpty--">isEmpty</a></span>()</code> </td> |
| </tr> |
| <tr id="i4" class="altColor"> |
| <td class="colFirst"><code><a href="../../freemarker/template/TemplateCollectionModel.html" title="interface in freemarker.template">TemplateCollectionModel</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../freemarker/template/SimpleHash.html#keys--">keys</a></span>()</code> </td> |
| </tr> |
| <tr id="i5" class="rowColor"> |
| <td class="colFirst"><code><a href="../../freemarker/template/TemplateHashModelEx2.KeyValuePairIterator.html" title="interface in freemarker.template">TemplateHashModelEx2.KeyValuePairIterator</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../freemarker/template/SimpleHash.html#keyValuePairIterator--">keyValuePairIterator</a></span>()</code> </td> |
| </tr> |
| <tr id="i6" class="altColor"> |
| <td class="colFirst"><code>void</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../freemarker/template/SimpleHash.html#put-java.lang.String-boolean-">put</a></span>(java.lang.String key, |
| boolean b)</code> |
| <div class="block">Puts a boolean in the map</div> |
| </td> |
| </tr> |
| <tr id="i7" class="rowColor"> |
| <td class="colFirst"><code>void</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../freemarker/template/SimpleHash.html#put-java.lang.String-java.lang.Object-">put</a></span>(java.lang.String key, |
| java.lang.Object value)</code> |
| <div class="block">Adds a key-value entry to this hash.</div> |
| </td> |
| </tr> |
| <tr id="i8" class="altColor"> |
| <td class="colFirst"><code>void</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../freemarker/template/SimpleHash.html#putAll-java.util.Map-">putAll</a></span>(java.util.Map m)</code> |
| <div class="block">Adds all the key/value entries in the map</div> |
| </td> |
| </tr> |
| <tr id="i9" class="rowColor"> |
| <td class="colFirst"><code>void</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../freemarker/template/SimpleHash.html#remove-java.lang.String-">remove</a></span>(java.lang.String key)</code> |
| <div class="block">Removes the given key from the underlying map.</div> |
| </td> |
| </tr> |
| <tr id="i10" class="altColor"> |
| <td class="colFirst"><code>int</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../freemarker/template/SimpleHash.html#size--">size</a></span>()</code> </td> |
| </tr> |
| <tr id="i11" class="rowColor"> |
| <td class="colFirst"><code><a href="../../freemarker/template/SimpleHash.html" title="class in freemarker.template">SimpleHash</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../freemarker/template/SimpleHash.html#synchronizedWrapper--">synchronizedWrapper</a></span>()</code> </td> |
| </tr> |
| <tr id="i12" class="altColor"> |
| <td class="colFirst"><code>java.util.Map</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../freemarker/template/SimpleHash.html#toMap--">toMap</a></span>()</code> |
| <div class="block">Note that this method creates and returns a deep-copy of the underlying hash used |
| internally.</div> |
| </td> |
| </tr> |
| <tr id="i13" class="rowColor"> |
| <td class="colFirst"><code>java.lang.String</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../freemarker/template/SimpleHash.html#toString--">toString</a></span>()</code> |
| <div class="block">Returns the <code>toString()</code> of the underlying <code>Map</code>.</div> |
| </td> |
| </tr> |
| <tr id="i14" class="altColor"> |
| <td class="colFirst"><code><a href="../../freemarker/template/TemplateCollectionModel.html" title="interface in freemarker.template">TemplateCollectionModel</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../freemarker/template/SimpleHash.html#values--">values</a></span>()</code> </td> |
| </tr> |
| </table> |
| <ul class="blockList"> |
| <li class="blockList"><a name="methods.inherited.from.class.freemarker.template.WrappingTemplateModel"> |
| <!-- --> |
| </a> |
| <h3>Methods inherited from class freemarker.template.<a href="../../freemarker/template/WrappingTemplateModel.html" title="class in freemarker.template">WrappingTemplateModel</a></h3> |
| <code><a href="../../freemarker/template/WrappingTemplateModel.html#getDefaultObjectWrapper--">getDefaultObjectWrapper</a>, <a href="../../freemarker/template/WrappingTemplateModel.html#getObjectWrapper--">getObjectWrapper</a>, <a href="../../freemarker/template/WrappingTemplateModel.html#setDefaultObjectWrapper-freemarker.template.ObjectWrapper-">setDefaultObjectWrapper</a>, <a href="../../freemarker/template/WrappingTemplateModel.html#setObjectWrapper-freemarker.template.ObjectWrapper-">setObjectWrapper</a>, <a href="../../freemarker/template/WrappingTemplateModel.html#wrap-java.lang.Object-">wrap</a></code></li> |
| </ul> |
| <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"> |
| <!-- ========= CONSTRUCTOR DETAIL ======== --> |
| <ul class="blockList"> |
| <li class="blockList"><a name="constructor.detail"> |
| <!-- --> |
| </a> |
| <h3>Constructor Detail</h3> |
| <a name="SimpleHash--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>SimpleHash</h4> |
| <pre>@Deprecated |
| public SimpleHash()</pre> |
| <div class="block"><span class="deprecatedLabel">Deprecated.</span> <span class="deprecationComment">Use <a href="../../freemarker/template/SimpleHash.html#SimpleHash-freemarker.template.ObjectWrapper-"><code>SimpleHash(ObjectWrapper)</code></a></span></div> |
| <div class="block">Constructs an empty hash that uses the default wrapper set in |
| <a href="../../freemarker/template/WrappingTemplateModel.html#setDefaultObjectWrapper-freemarker.template.ObjectWrapper-"><code>WrappingTemplateModel.setDefaultObjectWrapper(ObjectWrapper)</code></a>.</div> |
| </li> |
| </ul> |
| <a name="SimpleHash-java.util.Map-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>SimpleHash</h4> |
| <pre>@Deprecated |
| public SimpleHash(java.util.Map map)</pre> |
| <div class="block"><span class="deprecatedLabel">Deprecated.</span> <span class="deprecationComment">Use <a href="../../freemarker/template/SimpleHash.html#SimpleHash-java.util.Map-freemarker.template.ObjectWrapper-"><code>SimpleHash(Map, ObjectWrapper)</code></a></span></div> |
| <div class="block">Creates a new simple hash with the copy of the underlying map and the |
| default wrapper set in |
| <a href="../../freemarker/template/WrappingTemplateModel.html#setDefaultObjectWrapper-freemarker.template.ObjectWrapper-"><code>WrappingTemplateModel.setDefaultObjectWrapper(ObjectWrapper)</code></a>.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>map</code> - The Map to use for the key/value pairs. It makes a copy for |
| internal use. If the map implements the <code>SortedMap</code> interface, the |
| internal copy will be a <code>TreeMap</code>, otherwise it will be a |
| <code>HashMap</code>.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="SimpleHash-freemarker.template.ObjectWrapper-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>SimpleHash</h4> |
| <pre>public SimpleHash(<a href="../../freemarker/template/ObjectWrapper.html" title="interface in freemarker.template">ObjectWrapper</a> wrapper)</pre> |
| <div class="block">Creates an empty simple hash using the specified object wrapper.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>wrapper</code> - The object wrapper to use to wrap objects into |
| <a href="../../freemarker/template/TemplateModel.html" title="interface in freemarker.template"><code>TemplateModel</code></a> instances. If null, the default wrapper set in |
| <a href="../../freemarker/template/WrappingTemplateModel.html#setDefaultObjectWrapper-freemarker.template.ObjectWrapper-"><code>WrappingTemplateModel.setDefaultObjectWrapper(ObjectWrapper)</code></a> is |
| used.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="SimpleHash-java.util.Map-freemarker.template.ObjectWrapper-int-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>SimpleHash</h4> |
| <pre>public SimpleHash(java.util.Map<java.lang.String,java.lang.Object> directMap, |
| <a href="../../freemarker/template/ObjectWrapper.html" title="interface in freemarker.template">ObjectWrapper</a> wrapper, |
| int overloadDistinction)</pre> |
| <div class="block">Creates an instance that will use the specified <code>Map</code> directly as its backing store; beware, the |
| <code>Map</code> will be possibly modified by <a href="../../freemarker/template/SimpleHash.html" title="class in freemarker.template"><code>SimpleHash</code></a>, even if you only read the <a href="../../freemarker/template/SimpleHash.html" title="class in freemarker.template"><code>SimpleHash</code></a>. |
| That's because when a value is read, it's replaced with the corresponding <a href="../../freemarker/template/TemplateModel.html" title="interface in freemarker.template"><code>TemplateModel</code></a>. |
| |
| <p>The goal of this constructor is to allow you to control technical aspects, like the initial capacity, and |
| ordering of the underlying <code>Map</code> implementation. The iteration order of the <a href="../../freemarker/template/SimpleHash.html" title="class in freemarker.template"><code>SimpleHash</code></a> will be |
| the same as of the underlying <code>Map</code>.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>directMap</code> - The map that the instance will use directly as backing storage; possibly will be modified, |
| even when you only read the <a href="../../freemarker/template/SimpleHash.html" title="class in freemarker.template"><code>SimpleHash</code></a>! Must allow any kind of object as value, |
| including <code>null</code>! Supporting <code>null</code> keys is not needed.</dd> |
| <dd><code>overloadDistinction</code> - To avoid ambiguity with other overloads; the value is unused.</dd> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>2.3.30</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="SimpleHash-java.util.Map-freemarker.template.ObjectWrapper-"> |
| <!-- --> |
| </a> |
| <ul class="blockListLast"> |
| <li class="blockList"> |
| <h4>SimpleHash</h4> |
| <pre>public SimpleHash(java.util.Map map, |
| <a href="../../freemarker/template/ObjectWrapper.html" title="interface in freemarker.template">ObjectWrapper</a> wrapper)</pre> |
| <div class="block">Creates a new hash by shallow-coping (possibly cloning) the underlying map; in many applications you should use |
| <a href="../../freemarker/template/DefaultMapAdapter.html" title="class in freemarker.template"><code>DefaultMapAdapter</code></a> instead.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>map</code> - The Map to use for the key/value pairs. It makes a copy for internal use. If the map implements the |
| <code>SortedMap</code> interface, the internal copy will be a <code>TreeMap</code>, otherwise it will be a</dd> |
| <dd><code>wrapper</code> - The object wrapper to use to wrap contained objects into <a href="../../freemarker/template/TemplateModel.html" title="interface in freemarker.template"><code>TemplateModel</code></a> instances. Using |
| <code>null</code> is deprecated but allowed, in which case the deprecated default wrapper set in |
| <a href="../../freemarker/template/WrappingTemplateModel.html#setDefaultObjectWrapper-freemarker.template.ObjectWrapper-"><code>WrappingTemplateModel.setDefaultObjectWrapper(ObjectWrapper)</code></a> is used.</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="copyMap-java.util.Map-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>copyMap</h4> |
| <pre>protected java.util.Map copyMap(java.util.Map map)</pre> |
| </li> |
| </ul> |
| <a name="put-java.lang.String-java.lang.Object-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>put</h4> |
| <pre>public void put(java.lang.String key, |
| java.lang.Object value)</pre> |
| <div class="block">Adds a key-value entry to this hash.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>key</code> - The name by which the object is identified in the template.</dd> |
| <dd><code>value</code> - The value to which the name will be associated. This will only be wrapped to <a href="../../freemarker/template/TemplateModel.html" title="interface in freemarker.template"><code>TemplateModel</code></a> |
| lazily when it's first read.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="put-java.lang.String-boolean-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>put</h4> |
| <pre>public void put(java.lang.String key, |
| boolean b)</pre> |
| <div class="block">Puts a boolean in the map</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>key</code> - the name by which the resulting <tt>TemplateModel</tt> |
| is identified in the template.</dd> |
| <dd><code>b</code> - the boolean to store.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="get-java.lang.String-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>get</h4> |
| <pre>public <a href="../../freemarker/template/TemplateModel.html" title="interface in freemarker.template">TemplateModel</a> get(java.lang.String key) |
| 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/TemplateHashModel.html#get-java.lang.String-">TemplateHashModel</a></code></span></div> |
| <div class="block">Gets a <tt>TemplateModel</tt> from the hash.</div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Specified by:</span></dt> |
| <dd><code><a href="../../freemarker/template/TemplateHashModel.html#get-java.lang.String-">get</a></code> in interface <code><a href="../../freemarker/template/TemplateHashModel.html" title="interface in freemarker.template">TemplateHashModel</a></code></dd> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>key</code> - the name by which the <tt>TemplateModel</tt> |
| is identified in the template.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the <tt>TemplateModel</tt> referred to by the key, |
| or null if not found.</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="containsKey-java.lang.String-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>containsKey</h4> |
| <pre>public boolean containsKey(java.lang.String key)</pre> |
| <div class="block">Tells if the map contains a key or not, regardless if the associated value is <code>null</code> or not.</div> |
| <dl> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>2.3.20</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="remove-java.lang.String-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>remove</h4> |
| <pre>public void remove(java.lang.String key)</pre> |
| <div class="block">Removes the given key from the underlying map.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>key</code> - the key to be removed</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="putAll-java.util.Map-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>putAll</h4> |
| <pre>public void putAll(java.util.Map m)</pre> |
| <div class="block">Adds all the key/value entries in the map</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>m</code> - the map with the entries to add, the keys are assumed to be strings.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="toMap--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>toMap</h4> |
| <pre>public java.util.Map toMap() |
| throws <a href="../../freemarker/template/TemplateModelException.html" title="class in freemarker.template">TemplateModelException</a></pre> |
| <div class="block">Note that this method creates and returns a deep-copy of the underlying hash used |
| internally. This could be a gotcha for some people |
| at some point who want to alter something in the data model, |
| but we should maintain our immutability semantics (at least using default SimpleXXX wrappers) |
| for the data model. It will recursively unwrap the stuff in the underlying container.</div> |
| <dl> |
| <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="toString--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>toString</h4> |
| <pre>public java.lang.String toString()</pre> |
| <div class="block">Returns the <code>toString()</code> of the underlying <code>Map</code>.</div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code>toString</code> in class <code>java.lang.Object</code></dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="size--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>size</h4> |
| <pre>public int size()</pre> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Specified by:</span></dt> |
| <dd><code><a href="../../freemarker/template/TemplateHashModelEx.html#size--">size</a></code> in interface <code><a href="../../freemarker/template/TemplateHashModelEx.html" title="interface in freemarker.template">TemplateHashModelEx</a></code></dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the number of key/value mappings in the hash.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="isEmpty--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>isEmpty</h4> |
| <pre>public boolean isEmpty()</pre> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Specified by:</span></dt> |
| <dd><code><a href="../../freemarker/template/TemplateHashModel.html#isEmpty--">isEmpty</a></code> in interface <code><a href="../../freemarker/template/TemplateHashModel.html" title="interface in freemarker.template">TemplateHashModel</a></code></dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="keys--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>keys</h4> |
| <pre>public <a href="../../freemarker/template/TemplateCollectionModel.html" title="interface in freemarker.template">TemplateCollectionModel</a> keys()</pre> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Specified by:</span></dt> |
| <dd><code><a href="../../freemarker/template/TemplateHashModelEx.html#keys--">keys</a></code> in interface <code><a href="../../freemarker/template/TemplateHashModelEx.html" title="interface in freemarker.template">TemplateHashModelEx</a></code></dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>a collection containing the keys in the hash. Every element of |
| the returned collection must implement the <a href="../../freemarker/template/TemplateScalarModel.html" title="interface in freemarker.template"><code>TemplateScalarModel</code></a> |
| (as the keys of hashes are always strings).</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="values--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>values</h4> |
| <pre>public <a href="../../freemarker/template/TemplateCollectionModel.html" title="interface in freemarker.template">TemplateCollectionModel</a> values()</pre> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Specified by:</span></dt> |
| <dd><code><a href="../../freemarker/template/TemplateHashModelEx.html#values--">values</a></code> in interface <code><a href="../../freemarker/template/TemplateHashModelEx.html" title="interface in freemarker.template">TemplateHashModelEx</a></code></dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>a collection containing the values in the hash. The elements of the |
| returned collection can be any kind of <a href="../../freemarker/template/TemplateModel.html" title="interface in freemarker.template"><code>TemplateModel</code></a>-s.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="keyValuePairIterator--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>keyValuePairIterator</h4> |
| <pre>public <a href="../../freemarker/template/TemplateHashModelEx2.KeyValuePairIterator.html" title="interface in freemarker.template">TemplateHashModelEx2.KeyValuePairIterator</a> keyValuePairIterator()</pre> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Specified by:</span></dt> |
| <dd><code><a href="../../freemarker/template/TemplateHashModelEx2.html#keyValuePairIterator--">keyValuePairIterator</a></code> in interface <code><a href="../../freemarker/template/TemplateHashModelEx2.html" title="interface in freemarker.template">TemplateHashModelEx2</a></code></dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>The iterator that walks through the key-value pairs in the hash. Not <code>null</code>.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="synchronizedWrapper--"> |
| <!-- --> |
| </a> |
| <ul class="blockListLast"> |
| <li class="blockList"> |
| <h4>synchronizedWrapper</h4> |
| <pre>public <a href="../../freemarker/template/SimpleHash.html" title="class in freemarker.template">SimpleHash</a> synchronizedWrapper()</pre> |
| </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/SimpleHash.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/template/SimpleDate.html" title="class in freemarker.template"><span class="typeNameLink">Prev Class</span></a></li> |
| <li><a href="../../freemarker/template/SimpleList.html" title="class in freemarker.template"><span class="typeNameLink">Next Class</span></a></li> |
| </ul> |
| <ul class="navList"> |
| <li><a href="../../index.html?freemarker/template/SimpleHash.html" target="_top">Frames</a></li> |
| <li><a href="SimpleHash.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>Nested | </li> |
| <li>Field | </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>Field | </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> |