Class Util


  • public class Util
    extends Object
    Version:
    April 25, 2022
    Author:
    Yuriy Zabrovarnyy, Javier Rojas Blum
    • Method Detail

      • putNotBlank

        public static void putNotBlank​(Map map,
                                       String key,
                                       Object value)
      • escapeLog

        public static String escapeLog​(Object param)
      • createJsonMapper

        public static com.fasterxml.jackson.databind.ObjectMapper createJsonMapper()
      • asJsonSilently

        public static String asJsonSilently​(Object object)
      • getBytes

        public static byte[] getBytes​(String str)
      • asList

        public static List<String> asList​(org.json.JSONArray array)
                                   throws org.json.JSONException
        Throws:
        org.json.JSONException
      • addToListIfHas

        public static void addToListIfHas​(List<String> list,
                                          org.json.JSONObject jsonObj,
                                          String key)
                                   throws org.json.JSONException
        Throws:
        org.json.JSONException
      • addToJSONObjectIfNotNull

        public static void addToJSONObjectIfNotNull​(org.json.JSONObject jsonObject,
                                                    String key,
                                                    Object value)
                                             throws org.json.JSONException
        Throws:
        org.json.JSONException
      • addToJSONObjectIfNotNull

        public static void addToJSONObjectIfNotNull​(org.json.JSONObject jsonObject,
                                                    String key,
                                                    io.jans.orm.annotation.AttributeEnum value)
                                             throws org.json.JSONException
        Throws:
        org.json.JSONException
      • addToJSONObjectIfNotNull

        public static void addToJSONObjectIfNotNull​(org.json.JSONObject jsonObject,
                                                    String key,
                                                    String[] value)
                                             throws org.json.JSONException
        Throws:
        org.json.JSONException
      • addToJSONObjectIfNotNullOrEmpty

        public static void addToJSONObjectIfNotNullOrEmpty​(org.json.JSONObject jsonObject,
                                                           String key,
                                                           String[] value)
                                                    throws org.json.JSONException
        Throws:
        org.json.JSONException
      • addToJSONObjectIfNotNull

        public static void addToJSONObjectIfNotNull​(org.json.JSONObject jsonObject,
                                                    String key,
                                                    io.jans.orm.model.base.LocalizedString localizedString)
                                             throws org.json.JSONException
        Throws:
        org.json.JSONException
      • mapAsString

        public static String mapAsString​(Map<String,​String> map)
                                  throws org.json.JSONException
        Throws:
        org.json.JSONException
      • allNotBlank

        public static boolean allNotBlank​(String... strings)
      • splittedStringAsList

        public static List<String> splittedStringAsList​(String string,
                                                        String delimiter)
      • jsonArrayStringAsList

        public static List<String> jsonArrayStringAsList​(String jsonString)
                                                  throws org.json.JSONException
        Throws:
        org.json.JSONException
      • listToJsonArray

        public static org.json.JSONArray listToJsonArray​(Collection<String> list)
      • jsonObjectArrayStringAsMap

        public static Map<String,​String> jsonObjectArrayStringAsMap​(String jsonString)
                                                                   throws org.json.JSONException
        Parameters:
        jsonString - [{"CustomHeader1":"custom_header_value_1"},.....,{"CustomHeaderN":"custom_header_value_N"}]
        Returns:
        Throws:
        org.json.JSONException
      • firstItem

        public static <T> T firstItem​(List<T> items)
      • isNullOrEmpty

        public static boolean isNullOrEmpty​(String string)
      • parseIntSilently

        public static int parseIntSilently​(String intString)
      • parseIntSilently

        public static int parseIntSilently​(String intString,
                                           int defaultValue)
      • isBuiltInPasswordAuthn

        public static boolean isBuiltInPasswordAuthn​(String acr)
      • asInt

        public static int asInt​(Integer integer,
                                int fallback)
      • parseIntegerSilently

        public static Integer parseIntegerSilently​(String intString)
      • toSHA1HexString

        public static String toSHA1HexString​(String input)
      • byteArrayToHexString

        public static String byteArrayToHexString​(byte[] b)
      • createExpirationDate

        public static Date createExpirationDate​(Integer lifetimeInSeconds)
      • isPar

        public static boolean isPar​(String requestUri)
      • putArray

        public static void putArray​(org.json.JSONObject jsonObj,
                                    List<String> list,
                                    String key)