Package dev.iahmadgad.json
Class Converter
java.lang.Object
dev.iahmadgad.json.Converter
Convertor Class.
- Since:
- 0.3
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected Object[]
Converts JSONArray to array.toArrayList
(List<T> list) Converts list to ArrayList.toArrayList
(T[] array) Converts array to ArrayList.protected boolean[]
toBooleanArray
(JSONArray array) Converts JSONArray to array of booleans.toBooleanList
(JSONArray array) Converts JSONArray to list of Booleansprotected <T> T
toClass
(JSONObject object, Class<T> c) Converts JSONObject to Java object.protected double[]
toDoubleArray
(JSONArray array) Converts JSONArray to array of doubles.toDoubleList
(JSONArray array) Converts JSONArray to list of Doubles.protected int[]
toIntArray
(JSONArray array) Converts JSONArray to array of ints.toIntegerList
(JSONArray array) Converts JSONArray to list of Integers.protected <T> JSONArray
toJSONArray
(List<T> tlist) Converts list to JSONArray.protected <T> JSONArray
toJSONArray
(T[] tarray) Converts array to JSONArray.protected <T> JSONObject
toJSONObject
(Class<?> c, T tobject) Converts Java object to JSONObject.Converts JSONArray to listprotected String[]
toStringArray
(JSONArray array) Converts JSONArray to array of StringstoStringList
(JSONArray array) Converts JSONArray to list of Strings
-
Constructor Details
-
Converter
public Converter()
-
-
Method Details
-
toClass
Converts JSONObject to Java object.- Type Parameters:
T
-- Parameters:
object
-c
-- Returns:
- converted Java object
-
toJSONObject
Converts Java object to JSONObject.- Type Parameters:
T
-- Parameters:
c
-tobject
-- Returns:
- converted JSONObject
-
toJSONArray
Converts array to JSONArray.- Type Parameters:
T
-- Parameters:
tarray
-- Returns:
- converted JSONArray
-
toJSONArray
Converts list to JSONArray.- Type Parameters:
T
-- Parameters:
tlist
-- Returns:
- converted JSONArray
-
toArray
Converts JSONArray to array.- Parameters:
array
-- Returns:
- converted array
-
toStringArray
Converts JSONArray to array of Strings- Parameters:
array
-- Returns:
- converted array of Strings
-
toBooleanArray
Converts JSONArray to array of booleans.- Parameters:
array
-- Returns:
- converted array of booleans
-
toDoubleArray
Converts JSONArray to array of doubles.- Parameters:
array
-- Returns:
- converted array of doubles
-
toIntArray
Converts JSONArray to array of ints.- Parameters:
array
-- Returns:
- converted array of ints
-
toList
Converts JSONArray to list- Parameters:
array
-- Returns:
- converted list
-
toStringList
Converts JSONArray to list of Strings- Parameters:
array
-- Returns:
- converted list of Strings
-
toBooleanList
Converts JSONArray to list of Booleans- Parameters:
array
-- Returns:
- converted list of Booleans
-
toDoubleList
Converts JSONArray to list of Doubles.- Parameters:
array
-- Returns:
- converted list of Doubles
-
toIntegerList
Converts JSONArray to list of Integers.- Parameters:
array
-- Returns:
- converted list of Integers
-
toArrayList
Converts array to ArrayList.- Type Parameters:
T
-- Parameters:
array
-- Returns:
- converted ArrayList
-
toArrayList
Converts list to ArrayList.- Type Parameters:
T
-- Parameters:
list
-- Returns:
- converted ArrayList
-