Class JSONArray

java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractList<E>
java.util.ArrayList
org.drip.service.representation.JSONArray
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.lang.Iterable, java.util.Collection, java.util.List, java.util.RandomAccess, JSONAware, JSONStreamAware

public class JSONArray
extends java.util.ArrayList
implements java.util.List, JSONAware, JSONStreamAware
JSONArray is an Adaptation of the JSONArray class from the RFC4627 compliant JSON Simple (https://code.google.com/p/json-simple/). A JSON array. JSONObject supports List interface. It provides the following Functionality:
  • Encode a list into JSON text and write it to out.
  • Write the Contents of "this" to the Output Writer
  • Convert "this" to JSON text. The result is a JSON array. #1
  • Convert "this" to JSON text. The result is a JSON array. #2
  • Convert "this" to a "String", simply defers to JSON String

Module Computational Core Module
Library Computation Support
Project Environment, Product/Definition Containers, and Scenario/State Manipulation APIs
Package RFC4627 Compliant JSON Message Object

Author:
Fang Yidong, Lakshmi Krishnamurthy
See Also:
Serialized Form
  • Constructor Summary

    Constructors
    Constructor Description
    JSONArray()  
  • Method Summary

    Modifier and Type Method Description
    java.lang.String toJSONString()
    Convert "this" to JSON text.
    static java.lang.String toJSONString​(java.util.List list)
    Convert a list to JSON text.
    java.lang.String toString()
    Convert "this" to a "String", simply defers to JSON String
    void writeJSONString​(java.io.Writer outputWriter)
    Write the Contents of "this" to the Output Writer
    static void writeJSONString​(java.util.List list, java.io.Writer outputWriter)
    Encode a list into JSON text and write it to out.

    Methods inherited from class java.util.ArrayList

    add, add, addAll, addAll, clear, clone, contains, ensureCapacity, equals, forEach, get, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeIf, replaceAll, retainAll, set, size, sort, spliterator, subList, toArray, toArray, trimToSize

    Methods inherited from class java.util.AbstractCollection

    containsAll

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, wait, wait, wait

    Methods inherited from interface java.util.Collection

    parallelStream, removeIf, stream, toArray

    Methods inherited from interface java.lang.Iterable

    forEach

    Methods inherited from interface java.util.List

    add, add, addAll, addAll, clear, contains, containsAll, equals, get, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, replaceAll, retainAll, set, size, sort, spliterator, subList, toArray, toArray
  • Constructor Details

    • JSONArray

      public JSONArray()
  • Method Details

    • writeJSONString

      public static void writeJSONString​(java.util.List list, java.io.Writer outputWriter) throws java.io.IOException
      Encode a list into JSON text and write it to out. If this list is also a JSONStreamAware or a JSONAware, JSONStreamAware and JSONAware specific behaviours will be ignored at this top level.
      Parameters:
      list - List
      outputWriter - Output Writer
      Throws:
      java.io.IOException - Thrown if the Inputs are invalid
      See Also:
      JSONValue.writeJSONString(Object, Writer)
    • writeJSONString

      public void writeJSONString​(java.io.Writer outputWriter) throws java.io.IOException
      Write the Contents of "this" to the Output Writer
      Specified by:
      writeJSONString in interface JSONStreamAware
      Parameters:
      outputWriter - Output Writer
      Throws:
      java.io.IOException - Thrown if the Inputs are invalid
      See Also:
      JSONValue.writeJSONString(Object, Writer)
    • toJSONString

      public static java.lang.String toJSONString​(java.util.List list)
      Convert a list to JSON text. The result is a JSON array. If this list is also a JSONAware, JSONAware specific behaviours will be omitted at this top level.
      Parameters:
      list - List
      Returns:
      JSON text, or "null" if list is null.
      See Also:
      JSONValue.toJSONString(Object)
    • toJSONString

      public java.lang.String toJSONString()
      Convert "this" to JSON text. The result is a JSON array. If this list is also a JSONAware, JSONAware specific behaviours will be omitted at this top level.
      Specified by:
      toJSONString in interface JSONAware
      Returns:
      JSON text, or "null" if list is null.
      See Also:
      JSONValue.toJSONString(Object)
    • toString

      public java.lang.String toString()
      Convert "this" to a "String", simply defers to JSON String
      Overrides:
      toString in class java.util.AbstractCollection
      Returns:
      JSON text, or "null" if list is null.