Class Converter

java.lang.Object
dev.iahmadgad.json.Converter

public class Converter extends Object
Convertor Class.
Since:
0.3
  • Constructor Details

    • Converter

      public Converter()
  • Method Details

    • toClass

      protected <T> T toClass(JSONObject object, Class<T> c)
      Converts JSONObject to Java object.
      Type Parameters:
      T -
      Parameters:
      object -
      c -
      Returns:
      converted Java object
    • toJSONObject

      protected <T> JSONObject toJSONObject(Class<?> c, T tobject)
      Converts Java object to JSONObject.
      Type Parameters:
      T -
      Parameters:
      c -
      tobject -
      Returns:
      converted JSONObject
    • toJSONArray

      protected <T> JSONArray toJSONArray(T[] tarray)
      Converts array to JSONArray.
      Type Parameters:
      T -
      Parameters:
      tarray -
      Returns:
      converted JSONArray
    • toJSONArray

      protected <T> JSONArray toJSONArray(List<T> tlist)
      Converts list to JSONArray.
      Type Parameters:
      T -
      Parameters:
      tlist -
      Returns:
      converted JSONArray
    • toArray

      protected Object[] toArray(JSONArray array)
      Converts JSONArray to array.
      Parameters:
      array -
      Returns:
      converted array
    • toStringArray

      protected String[] toStringArray(JSONArray array)
      Converts JSONArray to array of Strings
      Parameters:
      array -
      Returns:
      converted array of Strings
    • toBooleanArray

      protected boolean[] toBooleanArray(JSONArray array)
      Converts JSONArray to array of booleans.
      Parameters:
      array -
      Returns:
      converted array of booleans
    • toDoubleArray

      protected double[] toDoubleArray(JSONArray array)
      Converts JSONArray to array of doubles.
      Parameters:
      array -
      Returns:
      converted array of doubles
    • toIntArray

      protected int[] toIntArray(JSONArray array)
      Converts JSONArray to array of ints.
      Parameters:
      array -
      Returns:
      converted array of ints
    • toList

      protected List<Object> toList(JSONArray array)
      Converts JSONArray to list
      Parameters:
      array -
      Returns:
      converted list
    • toStringList

      protected List<String> toStringList(JSONArray array)
      Converts JSONArray to list of Strings
      Parameters:
      array -
      Returns:
      converted list of Strings
    • toBooleanList

      protected List<Boolean> toBooleanList(JSONArray array)
      Converts JSONArray to list of Booleans
      Parameters:
      array -
      Returns:
      converted list of Booleans
    • toDoubleList

      protected List<Double> toDoubleList(JSONArray array)
      Converts JSONArray to list of Doubles.
      Parameters:
      array -
      Returns:
      converted list of Doubles
    • toIntegerList

      protected List<Integer> toIntegerList(JSONArray array)
      Converts JSONArray to list of Integers.
      Parameters:
      array -
      Returns:
      converted list of Integers
    • toArrayList

      protected <T> ArrayList<Object> toArrayList(T[] array)
      Converts array to ArrayList.
      Type Parameters:
      T -
      Parameters:
      array -
      Returns:
      converted ArrayList
    • toArrayList

      protected <T> ArrayList<Object> toArrayList(List<T> list)
      Converts list to ArrayList.
      Type Parameters:
      T -
      Parameters:
      list -
      Returns:
      converted ArrayList