public class Utils extends Object
Constructor and Description |
---|
Utils() |
Modifier and Type | Method and Description |
---|---|
static void |
checkIntGTEZ(int i,
String varName)
Check to ensure an integer is greater than or equal to zero.
|
static void |
checkIntGTZ(int i,
String varName)
Check to ensure an integer is greater than zero.
|
static void |
checkNull(Object value,
String varName)
Checks to see if something is null and throws an IllegalArgumentException
if it is
|
static void |
checkNullEmpty(String value,
String varName)
Checks to see if something is null or empty.
|
static BigDecimal |
getJsonNumber(javax.json.JsonNumber n) |
static BigDecimal |
getJsonNumber(javax.json.JsonObject obj,
String property) |
static <T extends Jsonable> |
jsonableToArray(List<T> data) |
static List<Boolean> |
jsonArrayToBooleanList(javax.json.JsonArray arr)
Convert a json array to a list of booleans.
|
static List<Integer> |
jsonArrayToIntList(javax.json.JsonArray arr)
Convert a json array to a list of integers.
|
static List<javax.json.JsonObject> |
jsonArrayToJsonObjectList(javax.json.JsonArray arr)
Convert a json array to a list of JsonObject instances.
|
static List<Long> |
jsonArrayToLongList(javax.json.JsonArray arr)
Convert a json array to a list of integers.
|
static List<String> |
jsonArrayToStringList(javax.json.JsonArray arr)
Convert a json array to a list of Strings.
|
static BigDecimal |
jsonNumberToBigDecimal(javax.json.JsonNumber n,
int defaultValue) |
static Money |
jsonNumberToMoney(javax.json.JsonNumber n) |
static float |
round(float d,
int decimalPlace,
RoundingMode mode)
Round something with bankers rounding
|
static <T> javax.json.JsonArray |
toJsonArray(List<T> data)
Turn some list of Jsonable into a json array
|
public static float round(float d, int decimalPlace, RoundingMode mode)
d
- float to rounddecimalPlace
- places to round topublic static <T> javax.json.JsonArray toJsonArray(List<T> data)
T
- data
- listpublic static <T extends Jsonable> javax.json.JsonArray jsonableToArray(List<T> data)
public static List<Long> jsonArrayToLongList(javax.json.JsonArray arr)
arr
- arrayClassCastException
- if any element in arr is not an integerpublic static List<Integer> jsonArrayToIntList(javax.json.JsonArray arr)
arr
- arrayClassCastException
- if any element in arr is not an integerpublic static List<String> jsonArrayToStringList(javax.json.JsonArray arr)
arr
- arrayClassCastException
- if any element in arr is not an stringpublic static List<Boolean> jsonArrayToBooleanList(javax.json.JsonArray arr)
arr
- arrayClassCastException
- if any element in arr is not an booleanpublic static List<javax.json.JsonObject> jsonArrayToJsonObjectList(javax.json.JsonArray arr)
arr
- arrayClassCastException
- if any element in arr is not convertable to JsonObjectpublic static void checkNullEmpty(String value, String varName) throws IllegalArgumentException
value
- Value to checkvarName
- Variable nameIllegalArgumentException
- If its badpublic static void checkNull(Object value, String varName) throws IllegalArgumentException
value
- Value to checkvarName
- Variable NameIllegalArgumentException
- if its badpublic static BigDecimal getJsonNumber(javax.json.JsonNumber n)
public static void checkIntGTEZ(int i, String varName) throws IllegalArgumentException
i
- int to checkvarName
- variable name for exception messageIllegalArgumentException
public static void checkIntGTZ(int i, String varName) throws IllegalArgumentException
i
- int to checkvarName
- variable name for exception messageIllegalArgumentException
public static BigDecimal getJsonNumber(javax.json.JsonObject obj, String property)
public static Money jsonNumberToMoney(javax.json.JsonNumber n)
public static BigDecimal jsonNumberToBigDecimal(javax.json.JsonNumber n, int defaultValue)
Copyright © 2017. All rights reserved.