soaprmi.util.dynamic_proxy
Class ThrowableRewrapper

java.lang.Object
  extended bysoaprmi.util.dynamic_proxy.ThrowableRewrapper

public class ThrowableRewrapper
extends java.lang.Object

This is utility class to make easier to deal with situation when API is not using classes that are thrown by implementation hidden behind dynamic proxies - in such case suer will be getting UndeclaredThrowableException.

For example if API implementation uses XSOAP for remote objects and is not using soaprmi.RemoteException then this utility class is able to wrap RemoteExzception into target API chainable exception.

Version:
$Revision: 1.5 $ $Date: 2003/04/06 00:04:25 $ (GMT)
Author:
Aleksander Slominski [http://www.extreme.indiana.edu/~aslom]

Constructor Summary
ThrowableRewrapper()
           
 
Method Summary
static java.lang.Object wrap(java.lang.Object objectToWrap, java.lang.Class throwableForWrapping, java.lang.String messageForWrappedException)
          Returns object implementing the same set of interface as wrapped object but with additional ability to catch all exception of wrapped object and wrap them into one target exception (provided as parameter) and it will take care of UndeclaredThrowableException if wrapped object is dynamic proxy and it generates undeclared exception.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ThrowableRewrapper

public ThrowableRewrapper()
Method Detail

wrap

public static java.lang.Object wrap(java.lang.Object objectToWrap,
                                    java.lang.Class throwableForWrapping,
                                    java.lang.String messageForWrappedException)
Returns object implementing the same set of interface as wrapped object but with additional ability to catch all exception of wrapped object and wrap them into one target exception (provided as parameter) and it will take care of UndeclaredThrowableException if wrapped object is dynamic proxy and it generates undeclared exception.

Additionally returned proxy will not do double wrapping i.e. in case when thrown exception is the same type or subtyppe of target exception then it will be passed through.

Parameters:
objectToWrap - an Object
Returns:
an Object


Copyright (c) 2004 IU Extreme! Lab http://www.extreme.indiana.edu/ All Rights Reserved.