public class Utils extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
DATE_FORMAT_DD_MM_YYYY |
static String |
DATE_FORMAT_DD_MM_YYYY_HH_MM_SS |
static String |
DATE_FORMAT_DD_MM_YYYY_HH_MM_SS_UNDERSCORES |
| Constructor and Description |
|---|
Utils() |
| Modifier and Type | Method and Description |
|---|---|
static <T> boolean |
addToCollectionIfNotNull(Collection<T> col,
T t) |
static Integer |
asInteger(String str) |
static String |
asString(Integer i) |
static Integer |
bigDecimal2Integer(BigDecimal bd) |
static Integer |
bigInteger2Integer(BigInteger bi) |
static LocalDateTime |
cnvString2LocalDateTime(String value) |
static LocalDateTime |
cnvString2LocalDateTime(String value,
String pattern) |
static LocalDateTime |
dateToLocalDateTime(Date date) |
static void |
delay(long time) |
static String |
formatJSON(String json,
boolean failOnParseError) |
static String |
formatLocalDateTime(LocalDateTime localDateTime)
Formatiert LocalDateTime to dd.MM.yyyy HH:mm:ss - string
|
static String |
formatXml(String xml) |
static <T extends Comparable<T>> |
getDefaultComparator() |
static Document |
getDocumentFromInputString(String xml) |
static <T> T |
getFirstElementOfCollection(Collection<T> col) |
static String |
getSystemProperty(String prop)
Get the system-property if set, otherwise the enironment variable.
|
static boolean |
isCollectionEmpty(Collection<?> col) |
static boolean |
isEmpty(String str) |
static boolean |
isEqual(Object o1,
Object o2) |
static boolean |
isNumeric(String str) |
static boolean |
isPositive(Number number) |
static Date |
localDateTimeToDate(LocalDateTime ldt) |
static String |
localDateTimeToString(LocalDateTime ld) |
static String |
localDateTimeToString(LocalDateTime ld,
String pattern) |
static String |
localDateToString(LocalDate ld) |
static String |
map2xml(Map<?,?> map,
boolean addType) |
static boolean |
mapContainsMap(Map<?,?> mapBase,
Map<?,?> mapCheckIfContains) |
static <K,V> AbstractMap.SimpleEntry<K,V> |
mapEntry(K key,
V value) |
static <K,V> Map<K,V> |
mapOfEntries(AbstractMap.SimpleEntry<K,V>... values) |
static <T extends Comparable<T>> |
min(T... t) |
static String |
nvl(String s) |
static <T> T |
nvl(T t1,
Supplier<T> t2) |
static <T> T |
nvl(T t1,
T t2) |
static <T> Collection<T> |
nvlCollection(Collection<T> col) |
static <T,K> Map<T,K> |
nvlMap(Map<T,K> map) |
static String |
object2Json(Object o) |
static String |
object2Json(Object o,
boolean withoutNullValues) |
static Date |
parseDate(String s,
String formatString,
boolean throwException)
Transforms a String to Date.
|
static String |
removeFromStringStart(String str,
String strToRemove) |
static void |
safeClose(Closeable... closeables) |
static Map<String,Object> |
xmlToMap(String xml) |
public static final String DATE_FORMAT_DD_MM_YYYY
public static final String DATE_FORMAT_DD_MM_YYYY_HH_MM_SS
public static final String DATE_FORMAT_DD_MM_YYYY_HH_MM_SS_UNDERSCORES
public static boolean isPositive(Number number)
public static boolean isNumeric(String str)
public static boolean isEmpty(String str)
public static <T> T getFirstElementOfCollection(Collection<T> col)
public static boolean isCollectionEmpty(Collection<?> col)
public static <T> T nvl(T t1,
T t2)
public static <T> T nvl(T t1,
Supplier<T> t2)
public static <T> Collection<T> nvlCollection(Collection<T> col)
public static <T extends Comparable<T>> T min(T... t)
public static <T extends Comparable<T>> Comparator<T> getDefaultComparator()
public static void safeClose(Closeable... closeables)
public static void delay(long time)
public static Integer bigDecimal2Integer(BigDecimal bd)
public static Integer bigInteger2Integer(BigInteger bi)
public static <T> boolean addToCollectionIfNotNull(Collection<T> col, T t)
public static String localDateTimeToString(LocalDateTime ld)
public static String localDateTimeToString(LocalDateTime ld, String pattern)
public static LocalDateTime dateToLocalDateTime(Date date)
public static LocalDateTime cnvString2LocalDateTime(String value)
value - - date in format dd.MM.yyyy HH:mm:sspublic static LocalDateTime cnvString2LocalDateTime(String value, String pattern)
value - - date as stringpattern - - pattern for datepublic static Date localDateTimeToDate(LocalDateTime ldt)
public static String formatLocalDateTime(LocalDateTime localDateTime)
localDateTime - - dateTimepublic static Date parseDate(String s, String formatString, boolean throwException)
s - - String to parseformatString - - patternthrowException - - throw exception on failure if true, else return nullnull, if s nullIllegalArgumentException - if s has invalid format or contentpublic static Document getDocumentFromInputString(String xml) throws Exception
Exceptionpublic static String object2Json(Object o) throws com.fasterxml.jackson.core.JsonProcessingException
com.fasterxml.jackson.core.JsonProcessingExceptionpublic static String object2Json(Object o, boolean withoutNullValues) throws com.fasterxml.jackson.core.JsonProcessingException
com.fasterxml.jackson.core.JsonProcessingException@SafeVarargs public static <K,V> Map<K,V> mapOfEntries(AbstractMap.SimpleEntry<K,V>... values)
public static <K,V> AbstractMap.SimpleEntry<K,V> mapEntry(K key, V value)
Copyright © 2024. All rights reserved.