org.jopendocument.util.cc
Class ExnTransformer<E,T,X extends Exception>

java.lang.Object
  extended by org.jopendocument.util.cc.ExnTransformer<E,T,X>
Type Parameters:
E - input type
T - return type
X - exception type
All Implemented Interfaces:
org.apache.commons.collections.Transformer, ITransformerExn<E,T,X>

public abstract class ExnTransformer<E,T,X extends Exception>
extends Object
implements org.apache.commons.collections.Transformer, ITransformerExn<E,T,X>

Transformer able to throw an exception.

Author:
Sylvain

Constructor Summary
ExnTransformer()
           
 
Method Summary
 Object transform(Object input)
           
abstract  T transformChecked(E input)
           
<Y extends Exception,Z extends Exception,A extends Exception>
T
transformCheckedWithExn(E input, boolean wrapRT, Class<Y> exnClass, Class<Z> exnClass2, Class<A> exnClass3)
          Execute this transformer, wrapping exceptions thrown by transformChecked(Object) into one of the passed exception classes.
<Y extends Exception>
T
transformCheckedWithExn(E input, Class<Y> exnClass)
          Execute this transformer, making sure that an exception of type exnClass is thrown.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExnTransformer

public ExnTransformer()
Method Detail

transform

public final Object transform(Object input)
Specified by:
transform in interface org.apache.commons.collections.Transformer

transformCheckedWithExn

public final <Y extends Exception> T transformCheckedWithExn(E input,
                                                             Class<Y> exnClass)
                                throws Y extends Exception
Execute this transformer, making sure that an exception of type exnClass is thrown.

Type Parameters:
Y - type of exception to throw.
Parameters:
input - the input.
exnClass - class exception to throw.
Returns:
the result of this transformer.
Throws:
Y - if transformChecked(Object) throws an exception, it will be wrapped (if necessary) in an exception of class exnClass.
Y extends Exception

transformCheckedWithExn

public final <Y extends Exception,Z extends Exception,A extends Exception> T transformCheckedWithExn(E input,
                                                                                                     boolean wrapRT,
                                                                                                     Class<Y> exnClass,
                                                                                                     Class<Z> exnClass2,
                                                                                                     Class<A> exnClass3)
                                throws Y extends Exception,
                                       Z extends Exception,
                                       A extends Exception
Execute this transformer, wrapping exceptions thrown by transformChecked(Object) into one of the passed exception classes.

Type Parameters:
Y - type of exception to throw.
Z - second type of exception to throw.
A - third type of exception to throw.
Parameters:
input - the input.
wrapRT - true so that even RuntimeException are wrapped into Y, false if this method should throw them as they are.
exnClass - class exception to throw.
exnClass2 - class exception to throw, can be null.
exnClass3 - class exception to throw, can be null.
Returns:
the result of this transformer.
Throws:
Y - if transformChecked(Object) throws an exception, it will be wrapped (if necessary) in an exception of class exnClass.
Z - if transformChecked(Object) throws an exception of class Z.
A - if transformChecked(Object) throws an exception of class A.
Y extends Exception

transformChecked

public abstract T transformChecked(E input)
                            throws X extends Exception
Specified by:
transformChecked in interface ITransformerExn<E,T,X extends Exception>
Throws:
X extends Exception


Copyright © 2010 jOpenDocument All Rights Reserved.