Class Util

java.lang.Object
de.yanwittmann.util.Util

public abstract class Util extends Object
  • Constructor Details

    • Util

      public Util()
  • Method Details

    • deepMerge

      public static org.json.JSONObject deepMerge(org.json.JSONObject source, org.json.JSONObject target) throws org.json.JSONException
      Written by erel-segal-halevi from this Stack Overflow answer
      Merge "source" into "target". If fields have equal name, merge them recursively.
      Returns:
      the merged object (target).
      Throws:
      org.json.JSONException
    • initializeListIfNull

      public static List initializeListIfNull(List list)
    • addToJson

      public static void addToJson(org.json.JSONObject json, String key, Object element)
      Will convert the passed data into a configuration-friendly format and add it to the JSON Object under the given key.
      Parameters:
      json - The JSON Object to add the data to.
      key - The key under which to add the data.
      element - The element to convert and add to the JSON Object.
    • mapRange

      public static double mapRange(double a1, double a2, double b1, double b2, double s)
      Written by rosettacode.org
      Parameters:
      a1 - The lower end of the original range.
      a2 - The upper end of the original range.
      b1 - The lower end of the destination range.
      b2 - The upper end of the destination range.
      s - The number to convert from the original range to the destination range.
      Returns:
      The number converted from the original range to the destination range.
    • roundToDecimals

      public static double roundToDecimals(double d, int c)
    • finalizeBuildString

      public static String finalizeBuildString(String build)