Class Util

java.lang.Object
sonia.scm.util.Util

public final class Util extends Object
  • Field Details

  • Method Details

    • compare

      public static <T extends Comparable> int compare(T object, T otherObject)
    • containsOne

      public static <T> boolean containsOne(Collection<T> collection, Collection<T> other)
    • convertTime

      public static String convertTime(long time)
    • convertTime

      public static long convertTime(String timeString)
    • createSubCollection

      public static <T> Collection<T> createSubCollection(Collection<T> values, Comparator<T> comparator, int start, int limit)
      Since:
      1.4
    • createSubCollection

      public static <T> Collection<T> createSubCollection(Collection<T> values, int start, int limit)
      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

      public static String formatDate(Date date, TimeZone tz)
    • formatDate

      public static String formatDate(Date date)
    • fromHexString

      public static byte[] fromHexString(String value)
    • nonNull

      public static String nonNull(Object value)
      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

      public static String nonNull(String value)
      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

      public static Date parseDate(String dateString, TimeZone tz) throws ParseException
      Throws:
      ParseException
    • parseDate

      public static Date parseDate(String dateString) throws ParseException
      Throws:
      ParseException
    • getFirst

      public static <K, V> V getFirst(com.google.common.collect.Multimap<K,V> map, K key)
      Returns the first value of a Multimap or null.
      Type Parameters:
      K - type of key
      V - type of
      Parameters:
      map - multi map
      key - key
      Returns:
      first value of null
      Since:
      2.0.0
    • startWithIgnoreCase

      public static boolean startWithIgnoreCase(String value, String start)
      Since:
      1.17
    • toString

      public static String toString(Collection<? extends Object> collection)
    • toString

      public static String toString(byte[] byteValue)
    • getFirst

      public static <T> T getFirst(Iterable<T> iterable)
      Since:
      1.5
    • getFirst

      public static <T> T getFirst(Iterator<T> iterator)
      Since:
      1.5
    • isEmpty

      public static boolean isEmpty(String value)
    • isEmpty

      public static boolean isEmpty(Collection<?> collection)
    • isEmpty

      public static boolean isEmpty(Map<?,?> map)
    • isEmpty

      public static boolean isEmpty(Object[] array)
    • isEquals

      public static boolean isEquals(Object object, Object other)
    • isNotEmpty

      public static boolean isNotEmpty(String value)
    • isNotEmpty

      public static boolean isNotEmpty(Collection<?> collection)
    • isNotEmpty

      public static boolean isNotEmpty(Map<?,?> map)
    • isNotEmpty

      public static boolean isNotEmpty(Object[] array)
    • isNotEquals

      public static boolean isNotEquals(Object object, Object other)