public abstract class JSONNode
extends java.lang.Object
implements freemarker.template.TemplateNodeModel, freemarker.template.AdapterTemplateModel, java.io.Serializable
| Modifier | Constructor and Description | 
|---|---|
protected  | 
JSONNode(JSONNode parentNode,
        java.lang.String nodeName)  | 
| Modifier and Type | Method and Description | 
|---|---|
protected abstract java.lang.String | 
getDefaultNodeName()
Returns the name of the node if it has no explicit name. 
 | 
java.lang.String | 
getNodeName()
Returns the same as  
TemplateNodeModel.getNodeType(), except when the node is the value in a key-value pair in a
 JSON object, in which case it returns the key value. | 
java.lang.String | 
getNodeNamespace()  | 
freemarker.template.TemplateNodeModel | 
getParentNode()
Returns the JSON "object" or JSON "array" that contains this value. 
 | 
protected static java.lang.String | 
nodeTypeToDefaultNodeName(java.lang.String nodeType)
Returns the FTL node name for a node that has otherwise no name. 
 | 
static JSONNode | 
wrap(java.lang.Object jsonPOJO)
 | 
protected static JSONNode | 
wrap(java.lang.Object obj,
    JSONNode parentNode,
    java.lang.String nodeName,
    boolean wrapNullAsJSONNullNode)  | 
protected JSONNode(JSONNode parentNode, java.lang.String nodeName)
parentNode - the JSON "object" or JSON "array" that contains this value.nodeName - null, unless this is the value in a key-value pair, in which case it's the key.
          When it's null, the actual node name will be getDefaultNodeName().protected static java.lang.String nodeTypeToDefaultNodeName(java.lang.String nodeType)
protected abstract java.lang.String getDefaultNodeName()
JSONNode(JSONNode, String) constructor if its second argument is null.nodeTypeToDefaultNodeName(String)public final freemarker.template.TemplateNodeModel getParentNode()
                                                          throws freemarker.template.TemplateModelException
getParentNode in interface freemarker.template.TemplateNodeModelfreemarker.template.TemplateModelExceptionpublic final java.lang.String getNodeName()
                                   throws freemarker.template.TemplateModelException
TemplateNodeModel.getNodeType(), except when the node is the value in a key-value pair in a
 JSON object, in which case it returns the key value.getNodeName in interface freemarker.template.TemplateNodeModelfreemarker.template.TemplateModelExceptionpublic final java.lang.String getNodeNamespace()
                                        throws freemarker.template.TemplateModelException
getNodeNamespace in interface freemarker.template.TemplateNodeModelfreemarker.template.TemplateModelExceptionpublic static JSONNode wrap(java.lang.Object jsonPOJO) throws freemarker.template.TemplateModelException
List, a Map with string keys, a String, a Number or a Boolean
 into a JSONNode. The values in the List or Map must be also be one of the previously
 listed types. The resulting object is NOT thread safe. Also, the wrapped objects shouldn't be changed after the
 wrapping. The wrapping of the contained values is possibly lazy.null for JSON null values, not a
          JSONNullNode instance.freemarker.template.TemplateModelException - If obj can't be wrapped into JSON node.protected static JSONNode wrap(java.lang.Object obj, JSONNode parentNode, java.lang.String nodeName, boolean wrapNullAsJSONNullNode) throws freemarker.template.TemplateModelException
parentNode - Same as the similar parameter of JSONNode(JSONNode, String).nodeName - Same as the similar parameter of JSONNode(JSONNode, String).freemarker.template.TemplateModelException - If obj can't be wrapped into JSON node.