public class JSONObjectNode extends JSONNode implements TemplateHashModelEx
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_NODE_NAME |
static String |
NODE_TYPE |
NOTHING
Constructor and Description |
---|
JSONObjectNode(JSONNode parentNode,
String nodeName,
Map map) |
Modifier and Type | Method and Description |
---|---|
TemplateModel |
get(String key)
|
TemplateSequenceModel |
getChildNodes() |
protected String |
getDefaultNodeName()
Returns the name of the node if it has no explicit name.
|
String |
getNodeType() |
boolean |
isEmpty() |
TemplateCollectionModel |
keys() |
int |
size() |
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, wrap
public static final String NODE_TYPE
public static final String DEFAULT_NODE_NAME
public JSONObjectNode(JSONNode parentNode, String nodeName, 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.public String getNodeType() throws TemplateModelException
getNodeType
in interface TemplateNodeModel
TemplateModelException
public TemplateModel get(String key) throws 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 TemplateHashModel
TemplateModelException
public boolean isEmpty() throws TemplateModelException
isEmpty
in interface TemplateHashModel
TemplateModelException
public int size() throws TemplateModelException
size
in interface TemplateHashModelEx
TemplateModelException
public TemplateSequenceModel getChildNodes() throws TemplateModelException
getChildNodes
in interface TemplateNodeModel
TemplateModelException
public TemplateCollectionModel keys() throws TemplateModelException
keys
in interface TemplateHashModelEx
TemplateModelException
public TemplateCollectionModel values() throws TemplateModelException
null
for JSON
null
-s. Note that getChildNodes()
treats JSON null
-s differently.values
in interface TemplateHashModelEx
TemplateModelException
protected String getDefaultNodeName()
JSONNode
JSONNode.JSONNode(JSONNode, String)
constructor if its second argument is null
.getDefaultNodeName
in class JSONNode
JSONNode.nodeTypeToDefaultNodeName(String)