Module api
Package de.grogra.api

Class APIReturn

java.lang.Object
de.grogra.api.APIReturn

public class APIReturn extends Object
This class is mainly a wrapper for a JSON object, therefore it is possible to add values to free or predefined fields. This fields can than parse to a JSONString and therefore can be transfered through the web server Additionally the status of the return can be set as a boolean to define if the request was successful
Author:
Tim Oberländer
  • Constructor Details

    • APIReturn

      public APIReturn()
      Initialize the JSONObject
  • Method Details

    • addPoint

      public void addPoint(String key, String objects)
      adding a String value, repented by a key, to the return data.
      Parameters:
      key -
      objects -
    • addPoint

      public void addPoint(String key, JSONArray list)
    • addPoint

      public void addPoint(String key, JSONObject obj)
    • addList

      public void addList(String key, Object[] values)
      Creating a JSONArray from a array of Strings and adding it, to the return data based on the given key.
      Parameters:
      key -
      keys -
    • addList

      public void addList(String key, StackTraceElement[] values)
      Creating a JSONArray from a array of Strings and adding it, to the return data based on the given key.
      Parameters:
      key -
      keys -
    • toString

      public String toString()
      encoding the data to a JSON repsentation
      Overrides:
      toString in class Object