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.

Author:
Lakshmi Krishnamurthy
  • Constructor Summary

    Constructors
    Constructor Description
    Converter()  
  • Method Summary

    Modifier and Type Method Description
    static JSONArray Array​(boolean[] ab)
    Construct a JSON Array out of the Boolean Array
    static JSONArray Array​(double[] adbl)
    Construct a JSON Array out of the Double Array
    static JSONArray Array​(double[][] aadbl)
    Construct a JSON 2D Array out of the 2D Double Array
    static JSONArray Array​(int[] ai)
    Construct a JSON Array out of the Integer Array
    static JSONArray Array​(java.lang.String[] astr)
    Construct a JSON Array out of the String Array
    static JSONArray Array​(JulianDate[] adt)
    Construct a JSON Array out of the JulianDate Array
    static boolean[] BooleanArrayEntry​(java.lang.Object objJSON)
    Convert the JSON Entry to a Boolean Array
    static boolean BooleanEntry​(JSONObject json, java.lang.String strEntryKey)
    Convert the JSON Entry to an Boolean
    static JulianDate[] DateArrayEntry​(JSONObject json, java.lang.String strEntryKey)
    Convert the JSON Entry to a Date Array
    static JulianDate DateEntry​(JSONObject json, java.lang.String strEntryKey)
    Convert the JSON Entry to a Date
    static double[] DoubleArrayEntry​(JSONObject json, java.lang.String strEntryKey)
    Convert the JSON Entry to a Double Array
    static double DoubleEntry​(JSONObject json, java.lang.String strEntryKey)
    Convert the JSON Entry to a Double
    static double[][] DualDoubleArrayEntry​(JSONObject json, java.lang.String strEntryKey)
    Convert the JSON Entry to a Dual Double Array
    static int[] IntegerArrayEntry​(java.lang.Object objJSON)
    Convert the JSON Entry to an Integer Array
    static int IntegerEntry​(JSONObject json, java.lang.String strEntryKey)
    Convert the JSON Entry to an Integer
    static java.lang.String[] StringArrayEntry​(JSONObject json, java.lang.String strEntryKey)
    Convert the JSON Entry to a String Array
    static java.lang.String StringEntry​(JSONObject json, java.lang.String strEntryKey)
    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 strEntryKey)
      Convert the JSON Entry to a String
      Parameters:
      json - The Object
      strEntryKey - The Entry Key
      Returns:
      The String Form of the JSON Entry
    • StringArrayEntry

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

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

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

      public static final double DoubleEntry​(JSONObject json, java.lang.String strEntryKey) throws java.lang.Exception
      Convert the JSON Entry to a Double
      Parameters:
      json - The Object
      strEntryKey - 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 strEntryKey)
      Convert the JSON Entry to a Double Array
      Parameters:
      json - The Object
      strEntryKey - The Entry Key
      Returns:
      The Double Array From of the JSON Entry
    • DualDoubleArrayEntry

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

      public static final int IntegerEntry​(JSONObject json, java.lang.String strEntryKey) throws java.lang.Exception
      Convert the JSON Entry to an Integer
      Parameters:
      json - The Object
      strEntryKey - 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 objJSON)
      Convert the JSON Entry to an Integer Array
      Parameters:
      objJSON - The JSON Object
      Returns:
      The Integer Array From of the JSON Entry
    • BooleanEntry

      public static final boolean BooleanEntry​(JSONObject json, java.lang.String strEntryKey) throws java.lang.Exception
      Convert the JSON Entry to an Boolean
      Parameters:
      json - The Object
      strEntryKey - 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 objJSON)
      Convert the JSON Entry to a Boolean Array
      Parameters:
      objJSON - The Object
      Returns:
      The Boolean Array From of the JSON Entry
    • Array

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

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

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

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

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

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