Class Util

java.lang.Object
io.jans.as.model.util.Util

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

  • Method Details

    • 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)
    • asPrettyJson

      public static String asPrettyJson(Object object) throws IOException
      Throws:
      IOException
    • asJson

      public static String asJson(Object object) throws IOException
      Throws:
      IOException
    • 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
    • asEnumList

      public static <T extends io.jans.orm.annotation.AttributeEnum> List<T> asEnumList(org.json.JSONArray array, Class<T> clazz) throws org.json.JSONException, NoSuchMethodException, InvocationTargetException, IllegalAccessException
      Throws:
      org.json.JSONException
      NoSuchMethodException
      InvocationTargetException
      IllegalAccessException
    • 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
    • asString

      public static String asString(List<? extends HasParamName> list)
    • listAsString

      public static String listAsString(List<String> list)
    • 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)
    • toSerializableMap

      public static Map<String,Serializable> toSerializableMap(Map<String,Object> map)
    • toSerializableMapOfStrings

      public static Map<String,String> toSerializableMapOfStrings(Map<String,Object> map)
    • putArray

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