Package fmpp.models

Class JSONArrayNode

java.lang.Object
fmpp.models.JSONNode
fmpp.models.JSONArrayNode
All Implemented Interfaces:
freemarker.template.AdapterTemplateModel, freemarker.template.TemplateModel, freemarker.template.TemplateNodeModel, freemarker.template.TemplateSequenceModel, Serializable

public class JSONArrayNode extends JSONNode implements freemarker.template.TemplateSequenceModel
JSON "array" value; see http://www.json.org/. This class is NOT thread safe.
See Also:
  • Field Details

  • Constructor Details

    • JSONArrayNode

      public JSONArrayNode(JSONNode parentNode, String nodeName, List elements)
  • Method Details

    • getChildNodes

      public freemarker.template.TemplateSequenceModel getChildNodes() throws freemarker.template.TemplateModelException
      Returns the JSONNode-s in this JSON array, using a JSONNullNode for JSON null-s. Note that get(int) treats JSON null-s differently.
      Specified by:
      getChildNodes in interface freemarker.template.TemplateNodeModel
      Throws:
      freemarker.template.TemplateModelException
    • getNodeType

      public String getNodeType() throws freemarker.template.TemplateModelException
      Returns NODE_TYPE.
      Specified by:
      getNodeType in interface freemarker.template.TemplateNodeModel
      Throws:
      freemarker.template.TemplateModelException
    • get

      public freemarker.template.TemplateModel get(int idx) throws freemarker.template.TemplateModelException
      Returns the JSONNode at the given index from this JSON array, using a Java null for JSON null-s. Note that getChildNodes() treats JSON null-s differently.
      Specified by:
      get in interface freemarker.template.TemplateSequenceModel
      Throws:
      freemarker.template.TemplateModelException
    • size

      public int size() throws freemarker.template.TemplateModelException
      Specified by:
      size in interface freemarker.template.TemplateSequenceModel
      Throws:
      freemarker.template.TemplateModelException
    • getDefaultNodeName

      protected String getDefaultNodeName()
      Description copied from class: JSONNode
      Returns the name of the node if it has no explicit name. This is normally called by the JSONNode(JSONNode, String) constructor if its second argument is null.
      Specified by:
      getDefaultNodeName in class JSONNode
      See Also:
    • getAdaptedObject

      public List<Object> getAdaptedObject(Class<?> hint)
      Returns the plain Java object wrapped into this node.
      Specified by:
      getAdaptedObject in interface freemarker.template.AdapterTemplateModel
      Since:
      0.9.16