org.jopendocument.util.cc
Class ExnTransformer<E,T,X extends java.lang.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 java.lang.Exception>
extends java.lang.Object
implements org.apache.commons.collections.Transformer, ITransformerExn<E,T,X>

Transformer able to throw an exception.

Author:
Sylvain

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

Constructor Detail

ExnTransformer

public ExnTransformer()
Method Detail

transform

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

transformCheckedWithExn

public final <Y extends java.lang.Exception> T transformCheckedWithExn(E input,
                                                                       java.lang.Class<Y> exnClass)
                                throws Y extends java.lang.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 java.lang.Exception

transformCheckedWithExn

public final <Y extends java.lang.Exception,Z extends java.lang.Exception,A extends java.lang.Exception> T transformCheckedWithExn(E input,
                                                                                                                                   boolean wrapRT,
                                                                                                                                   java.lang.Class<Y> exnClass,
                                                                                                                                   java.lang.Class<Z> exnClass2,
                                                                                                                                   java.lang.Class<A> exnClass3)
                                throws Y extends java.lang.Exception,
                                       Z extends java.lang.Exception,
                                       A extends java.lang.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 java.lang.Exception

transformChecked

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