Class BambooObjectUtils

java.lang.Object
com.atlassian.bamboo.util.BambooObjectUtils

public class BambooObjectUtils extends Object
  • Method Details

    • compare

      @Deprecated public static <T extends Comparable<T>> int compare(@Nullable T lhs, @Nullable T rhs)
      Deprecated.
      since 5.10, use ObjectUtils.compare(Comparable, Comparable)
      Compares two objects in a null-safe way. A null object is considered to be lesser than a non-null one
    • getId

      public static String getId(@Nullable @Nullable Object o)
    • rethrowAnyCauseThatIsInstanceOf

      public static <T extends Throwable, C extends T> RuntimeException rethrowAnyCauseThatIsInstanceOf(@NotNull T t, Class<C> toRethrowC) throws C
      Given a Throwable t, and a Throwable toRethrowC, if t is an instance of toRethrowC, it will be returned. Otherwise it will recursively look into chain of causes of Throwable t. If one of them is an instance of RethrowC, it will be returned. Otherwise, it will throw RuntimeException or, if it's already a RuntimeException, throw it directly. This method should be used when a method has a broad throws clause (e.g. Callable) and we know which checked exceptions it will return throwable of class toRethrowC or throw runtime exception.
      Throws:
      C extends T
    • getMessageOrStackTrace

      @NotNull public static @NotNull String getMessageOrStackTrace(@NotNull @NotNull Throwable throwable)
      Returns:
      a message from throwable, or, if there's no message create one using exception class name and stack trace
    • asRuntimeException

      public static <T extends Throwable> RuntimeException asRuntimeException(T t)
    • toString

      public static String toString(Object key)