Package sonia.scm.util
Class Util
java.lang.Object
sonia.scm.util.Util
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic <T extends Comparable>
intcompare
(T object, T otherObject) static <T> boolean
containsOne
(Collection<T> collection, Collection<T> other) static String
convertTime
(long time) static long
convertTime
(String timeString) static <T> Collection<T>
createSubCollection
(Collection<T> values, int start, int limit) static <T> Collection<T>
createSubCollection
(Collection<T> values, Comparator<T> comparator, int start, int limit) static <T> Collection<T>
createSubCollection
(Collection<T> values, Comparator<T> comparator, CollectionAppender<T> appender, int start, int limit) static <T> Collection<T>
createSubCollection
(Collection<T> values, CollectionAppender<T> appender, int start, int limit) static String
formatDate
(Date date) static String
formatDate
(Date date, TimeZone tz) static byte[]
fromHexString
(String value) static <K,
V> V getFirst
(com.google.common.collect.Multimap<K, V> map, K key) Returns the first value of aMultimap
ornull
.static <T> T
static <T> T
static boolean
static boolean
static boolean
isEmpty
(Collection<?> collection) static boolean
static boolean
static boolean
isNotEmpty
(Object[] array) static boolean
isNotEmpty
(String value) static boolean
isNotEmpty
(Collection<?> collection) static boolean
isNotEmpty
(Map<?, ?> map) static boolean
isNotEquals
(Object object, Object other) static String
Returns an emtpy string, if the object is null.static String
Returns an empty string, if the string is null.static Date
static Date
static boolean
startWithIgnoreCase
(String value, String start) static String
toString
(byte[] byteValue) static String
toString
(Collection<? extends Object> collection)
-
Field Details
-
DATE_PATTERN
- See Also:
-
EMPTY_STRING
- See Also:
-
-
Method Details
-
compare
-
containsOne
-
convertTime
-
convertTime
-
createSubCollection
public static <T> Collection<T> createSubCollection(Collection<T> values, Comparator<T> comparator, int start, int limit) - Since:
- 1.4
-
createSubCollection
- Since:
- 1.4
-
createSubCollection
public static <T> Collection<T> createSubCollection(Collection<T> values, CollectionAppender<T> appender, int start, int limit) - Since:
- 1.4
-
createSubCollection
public static <T> Collection<T> createSubCollection(Collection<T> values, Comparator<T> comparator, CollectionAppender<T> appender, int start, int limit) - Since:
- 1.4
-
formatDate
-
formatDate
-
fromHexString
-
nonNull
Returns an emtpy string, if the object is null. Otherwise, the result of the toString method of the object is returned.- Parameters:
value
- object- Returns:
- string value or empty string
- Since:
- 1.13
-
nonNull
Returns an empty string, if the string is null. Otherwise, the string is returned. The method is available to fix a possible linkage error which was introduced with version 1.14. Please have a look at: https://bitbucket.org/sdorra/scm-manager/issue/569/active-directory-plugin-not-working-in- Parameters:
value
- string value- Returns:
- string value or empty string
- Since:
- 1.38
-
parseDate
- Throws:
ParseException
-
parseDate
- Throws:
ParseException
-
getFirst
public static <K,V> V getFirst(com.google.common.collect.Multimap<K, V> map, K key) Returns the first value of aMultimap
ornull
.- Type Parameters:
K
- type of keyV
- type of- Parameters:
map
- multi mapkey
- key- Returns:
- first value of
null
- Since:
- 2.0.0
-
startWithIgnoreCase
- Since:
- 1.17
-
toString
-
toString
-
getFirst
- Since:
- 1.5
-
getFirst
- Since:
- 1.5
-
isEmpty
-
isEmpty
-
isEmpty
-
isEmpty
-
isEquals
-
isNotEmpty
-
isNotEmpty
-
isNotEmpty
-
isNotEmpty
-
isNotEquals
-