com.faunos.util
Class ThrowFactory<E extends Throwable,T extends E>

java.lang.Object
  extended by com.faunos.util.ThrowFactory<E,T>

public class ThrowFactory<E extends Throwable,T extends E>
extends Object

An exception factory. This is mostly used in utility classes that want to centralize, and abstract away the type of exception thrown when an error condition is met. In practice, this means that the parameterized type T will be a RuntimeException subclass.

Note:

I have changed my mind about checked exceptions: I now think they are a bad idea.


Nested Class Summary
static class ThrowFactory.InvocationException
           
 
Constructor Summary
ThrowFactory(Class<T> throwableClass)
           
 
Method Summary
 E create()
           
 E create(String message)
           
 E create(String message, Throwable cause)
           
 E create(Throwable cause)
           
 Class<T> getExceptionClass()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ThrowFactory

public ThrowFactory(Class<T> throwableClass)
Method Detail

create

public E create()

create

public E create(String message)

create

public E create(Throwable cause)

create

public E create(String message,
                Throwable cause)

getExceptionClass

public Class<T> getExceptionClass()


SourceForge.net Logo