org.jpu.patterns.common
Class JPUClassUtils

java.lang.Object
  extended byorg.jpu.patterns.common.JPUClassUtils

public class JPUClassUtils
extends java.lang.Object


Nested Class Summary
static class JPUClassUtils.IsAssignable
           
 
Constructor Summary
JPUClassUtils()
           
 
Method Summary
static boolean areAnyAssignable(java.util.Collection classesToTest, java.lang.Class toClass)
           
static void rethrowSafely(java.lang.Throwable t, java.lang.Class[] acceptableTypes)
          Rethrows the given Throwable in a manner designed to avoid UndeclaredThrowableException's.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JPUClassUtils

public JPUClassUtils()
Method Detail

areAnyAssignable

public static boolean areAnyAssignable(java.util.Collection classesToTest,
                                       java.lang.Class toClass)

rethrowSafely

public static void rethrowSafely(java.lang.Throwable t,
                                 java.lang.Class[] acceptableTypes)
                          throws java.lang.Throwable
Rethrows the given Throwable in a manner designed to avoid UndeclaredThrowableException's. If the given Throwable is an Error or RuntimeException, it is simply rethrown. Else its type is checked for assignment compatibility with the classes given by acceptableTypes. If it is type compatible, it is rethrown; else it is wrapped in a NestableRuntimeException which is then thrown.

Typically this method would be used for rethrowing exceptions caught inside an invocation handler's invoke() method.

Throws:
java.lang.Throwable


Copyright (c) 2001-2003 - Apache Software Foundation