Package org.drip.service.jsonparser
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 Arraystatic JSONArray
Array(double[] doubleArray)
Construct a JSON Array out of the Double Arraystatic JSONArray
Array(double[][] grid)
Construct a JSON 2D Array out of the 2D Double Arraystatic JSONArray
Array(int[] integerArray)
Construct a JSON Array out of the Integer Arraystatic JSONArray
Array(java.lang.String[] stringArray)
Construct a JSON Array out of the String Arraystatic JSONArray
Array(JulianDate[] dateArray)
Construct a JSON Array out of the JulianDate Arraystatic boolean[]
BooleanArrayEntry(java.lang.Object jsonObject)
Convert the JSON Entry to a Boolean Arraystatic boolean
BooleanEntry(JSONObject json, java.lang.String entryKey)
Convert the JSON Entry to an Booleanstatic JulianDate[]
DateArrayEntry(JSONObject json, java.lang.String entryKey)
Convert the JSON Entry to a Date Arraystatic JulianDate
DateEntry(JSONObject json, java.lang.String entryKey)
Convert the JSON Entry to a Datestatic double[]
DoubleArrayEntry(JSONObject json, java.lang.String entryKey)
Convert the JSON Entry to a Double Arraystatic double
DoubleEntry(JSONObject json, java.lang.String entryKey)
Convert the JSON Entry to a Doublestatic double[][]
DualDoubleArrayEntry(JSONObject json, java.lang.String entryKey)
Convert the JSON Entry to a Dual Double Arraystatic int[]
IntegerArrayEntry(java.lang.Object json)
Convert the JSON Entry to an Integer Arraystatic int
IntegerEntry(JSONObject json, java.lang.String entryKey)
Convert the JSON Entry to an Integerstatic java.lang.String[]
StringArrayEntry(JSONObject json, java.lang.String entryKey)
Convert the JSON Entry to a String Arraystatic java.lang.String
StringEntry(JSONObject json, java.lang.String entryKey)
Convert the JSON Entry to a StringMethods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
Converter
public Converter()
-
-
Method Details
-
StringEntry
Convert the JSON Entry to a String- Parameters:
json
- The ObjectentryKey
- 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 ObjectentryKey
- The Entry Key- Returns:
- The String Array From of the JSON Entry
-
DateEntry
Convert the JSON Entry to a Date- Parameters:
json
- The ObjectentryKey
- The Entry Key- Returns:
- The Date Form of the JSON Entry
-
DateArrayEntry
Convert the JSON Entry to a Date Array- Parameters:
json
- The ObjectentryKey
- 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.ExceptionConvert the JSON Entry to a Double- Parameters:
json
- The ObjectentryKey
- The Entry Key- Returns:
- The Double Form of the JSON Entry
- Throws:
java.lang.Exception
- Thrown if the Inputs are Invalid
-
DoubleArrayEntry
Convert the JSON Entry to a Double Array- Parameters:
json
- The ObjectentryKey
- The Entry Key- Returns:
- The Double Array From of the JSON Entry
-
DualDoubleArrayEntry
Convert the JSON Entry to a Dual Double Array- Parameters:
json
- The ObjectentryKey
- 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.ExceptionConvert the JSON Entry to an Integer- Parameters:
json
- The ObjectentryKey
- 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.ExceptionConvert the JSON Entry to an Boolean- Parameters:
json
- The ObjectentryKey
- 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
Construct a JSON Array out of the String Array- Parameters:
stringArray
- The String Array- Returns:
- The JSON Array Instance
-
Array
Construct a JSON Array out of the Integer Array- Parameters:
integerArray
- The Integer Array- Returns:
- The JSON Array Instance
-
Array
Construct a JSON Array out of the Double Array- Parameters:
doubleArray
- The Double Array- Returns:
- The JSON Array Instance
-
Array
Construct a JSON 2D Array out of the 2D Double Array- Parameters:
grid
- The 2D Double Array- Returns:
- The JSON 2D Array Instance
-
Array
Construct a JSON Array out of the JulianDate Array- Parameters:
booleanArray
- The Boolean Array- Returns:
- The JSON Array Instance
-
Array
Construct a JSON Array out of the JulianDate Array- Parameters:
dateArray
- The JulianDate Array- Returns:
- The JSON Array Instance
-