Class Converter

java.lang.Object
org.drip.service.jsonparser.Converter

public class Converter
extends java.lang.Object
TypeConverter transforms the JSON Object to certain Primitive/Simple Data Type Arrays, i.e., double, integer, String, or JulianDate Arrays. It provides the following Functionality:
  • Convert the JSON Entry to a String
  • Convert the JSON Entry to a String Array
  • Convert the JSON Entry to a Date
  • Convert the JSON Entry to a Date Array
  • Convert the JSON Entry to a Double
  • Convert the JSON Entry to a Double Array
  • Convert the JSON Entry to a Dual Double Array
  • Convert the JSON Entry to an Integer
  • Convert the JSON Entry to an Integer Array
  • Convert the JSON Entry to an Boolean
  • Convert the JSON Entry to a Boolean Array
  • Construct a JSON Array out of the String Array
  • Construct a JSON Array out of the Integer Array
  • Construct a JSON Array out of the Double Array
  • Construct a JSON 2D Array out of the 2D Double Array
  • Construct a JSON Array out of the JulianDate Array
  • Construct a JSON Array out of the Boolean Array

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

Author:
Lakshmi Krishnamurthy
  • Constructor Summary

    Constructors
    Constructor Description
    Converter()  
  • Method Summary

    Modifier and Type Method Description
    static JSONArray Array​(boolean[] booleanArray)
    Construct a JSON Array out of the JulianDate Array
    static JSONArray Array​(double[] doubleArray)
    Construct a JSON Array out of the Double Array
    static JSONArray Array​(double[][] grid)
    Construct a JSON 2D Array out of the 2D Double Array
    static JSONArray Array​(int[] integerArray)
    Construct a JSON Array out of the Integer Array
    static JSONArray Array​(java.lang.String[] stringArray)
    Construct a JSON Array out of the String Array
    static JSONArray Array​(JulianDate[] dateArray)
    Construct a JSON Array out of the JulianDate Array
    static boolean[] BooleanArrayEntry​(java.lang.Object jsonObject)
    Convert the JSON Entry to a Boolean Array
    static boolean BooleanEntry​(JSONObject json, java.lang.String entryKey)
    Convert the JSON Entry to an Boolean
    static JulianDate[] DateArrayEntry​(JSONObject json, java.lang.String entryKey)
    Convert the JSON Entry to a Date Array
    static JulianDate DateEntry​(JSONObject json, java.lang.String entryKey)
    Convert the JSON Entry to a Date
    static double[] DoubleArrayEntry​(JSONObject json, java.lang.String entryKey)
    Convert the JSON Entry to a Double Array
    static double DoubleEntry​(JSONObject json, java.lang.String entryKey)
    Convert the JSON Entry to a Double
    static double[][] DualDoubleArrayEntry​(JSONObject json, java.lang.String entryKey)
    Convert the JSON Entry to a Dual Double Array
    static int[] IntegerArrayEntry​(java.lang.Object json)
    Convert the JSON Entry to an Integer Array
    static int IntegerEntry​(JSONObject json, java.lang.String entryKey)
    Convert the JSON Entry to an Integer
    static java.lang.String[] StringArrayEntry​(JSONObject json, java.lang.String entryKey)
    Convert the JSON Entry to a String Array
    static java.lang.String StringEntry​(JSONObject json, java.lang.String entryKey)
    Convert the JSON Entry to a String

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Converter

      public Converter()
  • Method Details

    • StringEntry

      public static final java.lang.String StringEntry​(JSONObject json, java.lang.String entryKey)
      Convert the JSON Entry to a String
      Parameters:
      json - The Object
      entryKey - The Entry Key
      Returns:
      The String Form of the JSON Entry
    • StringArrayEntry

      public static final java.lang.String[] StringArrayEntry​(JSONObject json, java.lang.String entryKey)
      Convert the JSON Entry to a String Array
      Parameters:
      json - The Object
      entryKey - The Entry Key
      Returns:
      The String Array From of the JSON Entry
    • DateEntry

      public static final JulianDate DateEntry​(JSONObject json, java.lang.String entryKey)
      Convert the JSON Entry to a Date
      Parameters:
      json - The Object
      entryKey - The Entry Key
      Returns:
      The Date Form of the JSON Entry
    • DateArrayEntry

      public static final JulianDate[] DateArrayEntry​(JSONObject json, java.lang.String entryKey)
      Convert the JSON Entry to a Date Array
      Parameters:
      json - The Object
      entryKey - The Entry Key
      Returns:
      The Date Array From of the JSON Entry
    • DoubleEntry

      public static final double DoubleEntry​(JSONObject json, java.lang.String entryKey) throws java.lang.Exception
      Convert the JSON Entry to a Double
      Parameters:
      json - The Object
      entryKey - The Entry Key
      Returns:
      The Double Form of the JSON Entry
      Throws:
      java.lang.Exception - Thrown if the Inputs are Invalid
    • DoubleArrayEntry

      public static final double[] DoubleArrayEntry​(JSONObject json, java.lang.String entryKey)
      Convert the JSON Entry to a Double Array
      Parameters:
      json - The Object
      entryKey - The Entry Key
      Returns:
      The Double Array From of the JSON Entry
    • DualDoubleArrayEntry

      public static final double[][] DualDoubleArrayEntry​(JSONObject json, java.lang.String entryKey)
      Convert the JSON Entry to a Dual Double Array
      Parameters:
      json - The Object
      entryKey - The Entry Key
      Returns:
      The Dual Double Array From of the JSON Entry
    • IntegerEntry

      public static final int IntegerEntry​(JSONObject json, java.lang.String entryKey) throws java.lang.Exception
      Convert the JSON Entry to an Integer
      Parameters:
      json - The Object
      entryKey - The Entry Key
      Returns:
      The Integer Form of the JSON Entry
      Throws:
      java.lang.Exception - Thrown if the Inputs are Invalid
    • IntegerArrayEntry

      public static final int[] IntegerArrayEntry​(java.lang.Object json)
      Convert the JSON Entry to an Integer Array
      Parameters:
      json - The JSON Object
      Returns:
      The Integer Array From of the JSON Entry
    • BooleanEntry

      public static final boolean BooleanEntry​(JSONObject json, java.lang.String entryKey) throws java.lang.Exception
      Convert the JSON Entry to an Boolean
      Parameters:
      json - The Object
      entryKey - The Entry Key
      Returns:
      The Boolean Form of the JSON Entry
      Throws:
      java.lang.Exception - Thrown if the Inputs are Invalid
    • BooleanArrayEntry

      public static final boolean[] BooleanArrayEntry​(java.lang.Object jsonObject)
      Convert the JSON Entry to a Boolean Array
      Parameters:
      jsonObject - The Object
      Returns:
      The Boolean Array From of the JSON Entry
    • Array

      public static final JSONArray Array​(java.lang.String[] stringArray)
      Construct a JSON Array out of the String Array
      Parameters:
      stringArray - The String Array
      Returns:
      The JSON Array Instance
    • Array

      public static final JSONArray Array​(int[] integerArray)
      Construct a JSON Array out of the Integer Array
      Parameters:
      integerArray - The Integer Array
      Returns:
      The JSON Array Instance
    • Array

      public static final JSONArray Array​(double[] doubleArray)
      Construct a JSON Array out of the Double Array
      Parameters:
      doubleArray - The Double Array
      Returns:
      The JSON Array Instance
    • Array

      public static final JSONArray Array​(double[][] grid)
      Construct a JSON 2D Array out of the 2D Double Array
      Parameters:
      grid - The 2D Double Array
      Returns:
      The JSON 2D Array Instance
    • Array

      public static final JSONArray Array​(boolean[] booleanArray)
      Construct a JSON Array out of the JulianDate Array
      Parameters:
      booleanArray - The Boolean Array
      Returns:
      The JSON Array Instance
    • Array

      public static final JSONArray Array​(JulianDate[] dateArray)
      Construct a JSON Array out of the JulianDate Array
      Parameters:
      dateArray - The JulianDate Array
      Returns:
      The JSON Array Instance