Package io.jans.as.model.util
Class Util
java.lang.Object
io.jans.as.model.util.Util
- Version:
- April 25, 2022
- Author:
- Yuriy Zabrovarnyy, Javier Rojas Blum
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic void
addToJSONObjectIfNotNull
(org.json.JSONObject jsonObject, String key, io.jans.orm.annotation.AttributeEnum value) static void
addToJSONObjectIfNotNull
(org.json.JSONObject jsonObject, String key, io.jans.orm.model.base.LocalizedString localizedString) static void
addToJSONObjectIfNotNull
(org.json.JSONObject jsonObject, String key, Object value) static void
addToJSONObjectIfNotNull
(org.json.JSONObject jsonObject, String key, String[] value) static void
addToJSONObjectIfNotNullOrEmpty
(org.json.JSONObject jsonObject, String key, String[] value) static void
addToListIfHas
(List<String> list, org.json.JSONObject jsonObj, String key) static boolean
allNotBlank
(String... strings) static <T extends io.jans.orm.annotation.AttributeEnum>
List<T>asEnumList
(org.json.JSONArray array, Class<T> clazz) static int
static String
static String
asJsonSilently
(Object object) asList
(org.json.JSONArray array) static String
asPrettyJson
(Object object) static String
asString
(List<? extends HasParamName> list) static String
byteArrayToHexString
(byte[] b) static Date
createExpirationDate
(Integer lifetimeInSeconds) static com.fasterxml.jackson.databind.ObjectMapper
static String
static <T> T
static byte[]
static boolean
static boolean
isNullOrEmpty
(String string) static boolean
jsonArrayStringAsList
(String jsonString) jsonObjectArrayStringAsMap
(String jsonString) static String
listAsString
(List<String> list) static org.json.JSONArray
listToJsonArray
(Collection<String> list) static String
mapAsString
(Map<String, String> map) static Integer
parseIntegerSilently
(String intString) static int
parseIntSilently
(String intString) static int
parseIntSilently
(String intString, int defaultValue) static void
static void
putNotBlank
(Map map, String key, Object value) splittedStringAsList
(String string, String delimiter) static Map<String,
Serializable> toSerializableMap
(Map<String, Object> map) static String
toSHA1HexString
(String input)
-
Field Details
-
UTF8_STRING_ENCODING
- See Also:
-
PAR_ID_REFIX
- See Also:
-
PAR_ID_SHORT_REFIX
- See Also:
-
-
Method Details
-
putNotBlank
-
escapeLog
-
createJsonMapper
public static com.fasterxml.jackson.databind.ObjectMapper createJsonMapper() -
asJsonSilently
-
asPrettyJson
- Throws:
IOException
-
asJson
- Throws:
IOException
-
getBytes
-
asList
- 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
-
listAsString
-
mapAsString
- Throws:
org.json.JSONException
-
allNotBlank
-
splittedStringAsList
-
jsonArrayStringAsList
- Throws:
org.json.JSONException
-
listToJsonArray
-
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
-
isNullOrEmpty
-
parseIntSilently
-
parseIntSilently
-
isBuiltInPasswordAuthn
-
asInt
-
parseIntegerSilently
-
toSHA1HexString
-
byteArrayToHexString
-
createExpirationDate
-
isPar
-
toSerializableMap
-
toSerializableMapOfStrings
-
putArray
-