com.atlassian.bamboo.util
Class BambooObjectUtils

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

public class BambooObjectUtils
extends java.lang.Object


Method Summary
static
<T extends java.lang.Comparable<T>>
int
compare(T lhs, T rhs)
          Compares two objects in a null-safe way.
static
<T> T
defaultObject(T object, T defaultVal)
           
static java.lang.String getId(java.lang.Object o)
           
static java.lang.String getMessageOrStackTrace(java.lang.Throwable throwable)
          returns a message from throwable, or, if there's no message create one using exception class name and stack trace
static
<T extends java.lang.Throwable,C extends T>
java.lang.RuntimeException
rethrow(T t, java.lang.Class<C> toRethrowC)
          Given a Throwable t, and a Trowable toRethrowC, if t is an instance of toRethrowC, it will be rethrown.
static
<T extends java.lang.Throwable,C extends T,D extends T>
java.lang.RuntimeException
rethrow(T t, java.lang.Class<C> toRethrowC, java.lang.Class<D> toRethrowD)
          Given a Throwable t, and a Trowables toRethrowC, toRethrowD, if t is an instance of toRethrowC or toRethrowD, it will be rethrown.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

compare

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


defaultObject

@Nullable
public static <T> T defaultObject(@Nullable
                                           T object,
                                           @Nullable
                                           T defaultVal)

getId

public static java.lang.String getId(@Nullable
                                     java.lang.Object o)

rethrow

public static <T extends java.lang.Throwable,C extends T> java.lang.RuntimeException rethrow(T t,
                                                                                             java.lang.Class<C> toRethrowC)
                                          throws C extends T
Given a Throwable t, and a Trowable toRethrowC, if t is an instance of toRethrowC, it will be rethrown. Otherwise, it will be returned as a RuntimeException or, if it's already a RuntimeException, returned directly. This method should be used when a method has a broad throws clause (e.g. Callable) and we know which checked exceptions it may actually throw.

Throws:
C extends T

getMessageOrStackTrace

@NotNull
public static java.lang.String getMessageOrStackTrace(@NotNull
                                                              java.lang.Throwable throwable)
returns a message from throwable, or, if there's no message create one using exception class name and stack trace

Returns:

rethrow

public static <T extends java.lang.Throwable,C extends T,D extends T> java.lang.RuntimeException rethrow(T t,
                                                                                                         java.lang.Class<C> toRethrowC,
                                                                                                         java.lang.Class<D> toRethrowD)
                                          throws C extends T,
                                                 D extends T
Given a Throwable t, and a Trowables toRethrowC, toRethrowD, if t is an instance of toRethrowC or toRethrowD, it will be rethrown. Otherwise, it will be returned as a RuntimeException or, if it's already a RuntimeException, returned directly. This method should be used when a method has a broad throws clause (e.g. Callable) and we know which checked exceptions it may actually throw.

Throws:
C extends T


Copyright © 2012 Atlassian. All Rights Reserved.