public class JSONObjectNode extends JSONNode implements freemarker.template.TemplateHashModelEx2
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
DEFAULT_NODE_NAME |
static java.lang.String |
NODE_TYPE |
| Constructor and Description |
|---|
JSONObjectNode(JSONNode parentNode,
java.lang.String nodeName,
java.util.Map map) |
| Modifier and Type | Method and Description |
|---|---|
freemarker.template.TemplateModel |
get(java.lang.String key)
|
java.util.Map<java.lang.String,java.lang.Object> |
getAdaptedObject(java.lang.Class<?> hint)
Returns the plain Java object wrapped into this node.
|
freemarker.template.TemplateSequenceModel |
getChildNodes() |
protected java.lang.String |
getDefaultNodeName()
Returns the name of the node if it has no explicit name.
|
java.lang.String |
getNodeType() |
boolean |
isEmpty() |
freemarker.template.TemplateCollectionModel |
keys() |
freemarker.template.TemplateHashModelEx2.KeyValuePairIterator |
keyValuePairIterator() |
int |
size() |
freemarker.template.TemplateCollectionModel |
values()
Returns the values from the key-value pairs of this JSON object, returning Java
null for JSON
null-s. |
getNodeName, getNodeNamespace, getParentNode, nodeTypeToDefaultNodeName, wrap, wrappublic static final java.lang.String NODE_TYPE
public static final java.lang.String DEFAULT_NODE_NAME
public JSONObjectNode(JSONNode parentNode, java.lang.String nodeName, java.util.Map map)
map - The JSON name-value pairs. The keys must be String-s, and values must be of a type that
JSONNode.wrap(Object) can wrap. The values should be plain Java objects, not JSONNode-s,
or else AdapterTemplateModel.getAdaptedObject(Class) won't work properly.public java.lang.String getNodeType()
throws freemarker.template.TemplateModelException
getNodeType in interface freemarker.template.TemplateNodeModelfreemarker.template.TemplateModelExceptionpublic freemarker.template.TemplateModel get(java.lang.String key)
throws freemarker.template.TemplateModelException
JSONNode for the given key from this JSON object, using a Java null for JSON
null-s. Note that getChildNodes() treats JSON null-s differently.get in interface freemarker.template.TemplateHashModelfreemarker.template.TemplateModelExceptionpublic boolean isEmpty()
throws freemarker.template.TemplateModelException
isEmpty in interface freemarker.template.TemplateHashModelfreemarker.template.TemplateModelExceptionpublic int size()
throws freemarker.template.TemplateModelException
size in interface freemarker.template.TemplateHashModelExfreemarker.template.TemplateModelExceptionpublic freemarker.template.TemplateSequenceModel getChildNodes()
throws freemarker.template.TemplateModelException
getChildNodes in interface freemarker.template.TemplateNodeModelfreemarker.template.TemplateModelExceptionpublic freemarker.template.TemplateCollectionModel keys()
throws freemarker.template.TemplateModelException
keys in interface freemarker.template.TemplateHashModelExfreemarker.template.TemplateModelExceptionpublic freemarker.template.TemplateCollectionModel values()
throws freemarker.template.TemplateModelException
null for JSON
null-s. Note that getChildNodes() treats JSON null-s differently.values in interface freemarker.template.TemplateHashModelExfreemarker.template.TemplateModelExceptionpublic freemarker.template.TemplateHashModelEx2.KeyValuePairIterator keyValuePairIterator()
throws freemarker.template.TemplateModelException
keyValuePairIterator in interface freemarker.template.TemplateHashModelEx2freemarker.template.TemplateModelExceptionprotected java.lang.String getDefaultNodeName()
JSONNodeJSONNode.JSONNode(JSONNode, String) constructor if its second argument is null.getDefaultNodeName in class JSONNodeJSONNode.nodeTypeToDefaultNodeName(String)public java.util.Map<java.lang.String,java.lang.Object> getAdaptedObject(java.lang.Class<?> hint)
getAdaptedObject in interface freemarker.template.AdapterTemplateModel