Java Doc for SimpleHash.java in  » Template-Engine » freemarker-2.3.10 » freemarker » template » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Template Engine » freemarker 2.3.10 » freemarker.template 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   freemarker.template.WrappingTemplateModel
      freemarker.template.SimpleHash

All known Subclasses:   freemarker.ext.servlet.AllHttpScopesHashModel,
SimpleHash
public class SimpleHash extends WrappingTemplateModel implements TemplateHashModelEx,Serializable(Code)

A simple implementation of the TemplateHashModelEx interface, using an underlying Map or SortedMap .

This class is thread-safe if you don't call the put or remove methods after you have made the object available for multiple threads.

Note:
As of 2.0, this class is unsynchronized by default. To obtain a synchronized wrapper, call the SimpleHash.synchronizedWrapper method.


version:
   $Id: SimpleHash.java,v 1.72.2.2 2006/02/26 18:26:18 revusky Exp $
See Also:   SimpleSequence
See Also:   SimpleScalar



Constructor Summary
public  SimpleHash()
     Constructs an empty hash that uses the default wrapper set in WrappingTemplateModel.setDefaultObjectWrapper(ObjectWrapper) .
public  SimpleHash(Map map)
     Creates a new simple hash with the copy of the underlying map and the default wrapper set in WrappingTemplateModel.setDefaultObjectWrapper(ObjectWrapper) .
Parameters:
  map - The Map to use for the key/value pairs.
public  SimpleHash(ObjectWrapper wrapper)
     Creates an empty simple hash using the specified object wrapper.
Parameters:
  wrapper - The object wrapper to use to wrap objects intoTemplateModel instances.
public  SimpleHash(Map map, ObjectWrapper wrapper)
     Creates a new simple hash with the copy of the underlying map and either the default wrapper set in WrappingTemplateModel.setDefaultObjectWrapper(ObjectWrapper) , or the freemarker.ext.beans.BeansWrapper JavaBeans wrapper .
Parameters:
  map - The Map to use for the key/value pairs.

Method Summary
protected  MapcopyMap(Map map)
    
public  TemplateModelget(String key)
    
public  booleanisEmpty()
    
public  TemplateCollectionModelkeys()
    
public  voidput(String key, Object obj)
     Adds a key-value entry to the map.
public  voidput(String key, boolean b)
    
public  voidputAll(Map m)
    
public  voidremove(String key)
     Removes the given key from the underlying map.
public  intsize()
    
public  SimpleHashsynchronizedWrapper()
    
public  MaptoMap()
     Note that this method creates and returns a deep-copy of the underlying hash used internally.
public  StringtoString()
     Convenience method for returning the String value of the underlying map.
public  TemplateCollectionModelvalues()
    


Constructor Detail
SimpleHash
public SimpleHash()(Code)
Constructs an empty hash that uses the default wrapper set in WrappingTemplateModel.setDefaultObjectWrapper(ObjectWrapper) .



SimpleHash
public SimpleHash(Map map)(Code)
Creates a new simple hash with the copy of the underlying map and the default wrapper set in WrappingTemplateModel.setDefaultObjectWrapper(ObjectWrapper) .
Parameters:
  map - The Map to use for the key/value pairs. It makes a copy for internal use. If the map implements the SortedMap interface, theinternal copy will be a TreeMap, otherwise it will be a HashMap.



SimpleHash
public SimpleHash(ObjectWrapper wrapper)(Code)
Creates an empty simple hash using the specified object wrapper.
Parameters:
  wrapper - The object wrapper to use to wrap objects intoTemplateModel instances. If null, the default wrapper set in WrappingTemplateModel.setDefaultObjectWrapper(ObjectWrapper) isused.



SimpleHash
public SimpleHash(Map map, ObjectWrapper wrapper)(Code)
Creates a new simple hash with the copy of the underlying map and either the default wrapper set in WrappingTemplateModel.setDefaultObjectWrapper(ObjectWrapper) , or the freemarker.ext.beans.BeansWrapper JavaBeans wrapper .
Parameters:
  map - The Map to use for the key/value pairs. It makes a copy for internal use. If the map implements the SortedMap interface, theinternal copy will be a TreeMap, otherwise it will be a
Parameters:
  wrapper - The object wrapper to use to wrap objects intoTemplateModel instances. If null, the default wrapper set in WrappingTemplateModel.setDefaultObjectWrapper(ObjectWrapper) isused.




Method Detail
copyMap
protected Map copyMap(Map map)(Code)



get
public TemplateModel get(String key) throws TemplateModelException(Code)



isEmpty
public boolean isEmpty()(Code)



keys
public TemplateCollectionModel keys()(Code)



put
public void put(String key, Object obj)(Code)
Adds a key-value entry to the map.
Parameters:
  key - the name by which the object isidentified in the template.
Parameters:
  obj - the object to store.



put
public void put(String key, boolean b)(Code)
Puts a boolean in the map
Parameters:
  key - the name by which the resulting TemplateModelis identified in the template.
Parameters:
  b - the boolean to store.



putAll
public void putAll(Map m)(Code)
Adds all the key/value entries in the map
Parameters:
  m - the map with the entries to add, the keys are assumed to be strings.



remove
public void remove(String key)(Code)
Removes the given key from the underlying map.
Parameters:
  key - the key to be removed



size
public int size()(Code)



synchronizedWrapper
public SimpleHash synchronizedWrapper()(Code)



toMap
public Map toMap() throws TemplateModelException(Code)
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.



toString
public String toString()(Code)
Convenience method for returning the String value of the underlying map.



values
public TemplateCollectionModel values()(Code)



Methods inherited from freemarker.template.WrappingTemplateModel
public static ObjectWrapper getDefaultObjectWrapper()(Code)(Java Doc)
public ObjectWrapper getObjectWrapper()(Code)(Java Doc)
public static void setDefaultObjectWrapper(ObjectWrapper objectWrapper)(Code)(Java Doc)
public void setObjectWrapper(ObjectWrapper objectWrapper)(Code)(Java Doc)
final protected TemplateModel wrap(Object obj) throws TemplateModelException(Code)(Java Doc)

Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.