|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object freemarker.template.FastHash<V>
public final class FastHash<V extends TemplateModel>
An unsynchronized variation of the SimpleHash
class to handle
key-pair values. This means that FastHash
should be
significantly faster than SimpleHash
in some cases.
Instances of this class should be used in situations where either:
Map
never changes, orNote that every template process is performed synchronously, so within a single-threaded application instances of this class will always be safe.
FastBoolean
,
FastList
,
FastNumber
,
FastScalar
,
Serialized FormConstructor Summary | |
---|---|
FastHash()
Default constructor. |
|
FastHash(java.util.Map<java.lang.String,V> hash)
Constructs an FastHash given the backing Map . |
Method Summary | |
---|---|
boolean |
equals(java.lang.Object o)
Tests this object for equality with the given object. |
TemplateModel |
get(java.lang.String key)
Gets a TemplateModel from the hash. |
java.lang.Object |
getAsObject()
Return an unmodifiable view of the underlying Map object
for manipulation by the freemarker.ext.beans package. |
int |
hashCode()
Return the hash value for this object. |
boolean |
isEmpty()
Is the model empty? |
void |
put(java.lang.String key,
TemplateModel model)
Sets a value in the hash model. |
void |
remove(java.lang.String key)
Removes a key from the hash model. |
java.lang.String |
toString()
Returns a String representation of the object. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public FastHash()
public FastHash(java.util.Map<java.lang.String,V> hash)
FastHash
given the backing Map
.
hash
- The Map to use as the backing for this FastHash.
java.lang.NullPointerException
- the map is nullMethod Detail |
---|
public boolean isEmpty()
isEmpty
in interface TemplateModel
true
if this object is empty, otherwise false
public TemplateModel get(java.lang.String key)
TemplateModel
from the hash.
get
in interface TemplateHashModel
key
- the name by which the TemplateModel
is identified in the template.
TemplateModel
referred to by the key,
or null
if not found.public void put(java.lang.String key, TemplateModel model)
put
in interface TemplateModelRoot
put
in interface TemplateWriteableHashModel
key
- the hash key.model
- the hash value.public void remove(java.lang.String key)
remove
in interface TemplateModelRoot
key
- the key to be removed.public java.lang.Object getAsObject() throws TemplateModelException
Return an unmodifiable view of the underlying Map
object
for manipulation by the freemarker.ext.beans
package.
getAsObject
in interface TemplateObjectModel
Map
object
TemplateModelException
- the object could not be returnedpublic java.lang.String toString()
String
representation of the object.
toString
in class java.lang.Object
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
o
- the object to be compared with
true
if the object is equal, otherwise
false
public int hashCode()
hashCode
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |