1. import java.lang.reflect.Method;
  2. import java.util.ArrayList;
  3. import java.util.List;
  4. import net.sf.cglib.proxy.MethodProxy;
  5. import org.primitive.interfaces.ITestObjectExceptionHandler;
  6. /**
  7. * @author s.tihomirov
  8. * this is an abstract class. It's inheritors should handle exceptions of defined types
  9. */
  10. public abstract class TestObjectExceptionHandler implements ITestObjectExceptionHandler{
  11. protected List<Class<? extends Throwable>> throwableList = new ArrayList<Class<? extends Throwable>>();
  12. public TestObjectExceptionHandler(Class<? extends Throwable> tClass)
  13. {
  14. throwableList.add(tClass);
  15. }
  16. public TestObjectExceptionHandler(List<Class<? extends Throwable>> tClassList)
  17. {
  18. throwableList.addAll(tClassList);
  19. }
  20. @Override
  21. public abstract Object handleException(Object object, Method originalMethod, MethodProxy methodProxy, Object[] args, Throwable t) throws Throwable;
  22. }
Comments powered by Disqus