|
Evaluating Software Design Patterns — the "Gang of Four" patterns implemented in Java 6 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.lang.Throwable java.lang.Exception java.lang.RuntimeException dk.rode.thesis.singleton.SingletonException
public class SingletonException
A singleton exception is thrown in case a given
type cannot be determined to be a singleton type when requested
from a given registry
or in case
a singleton instance cannot be acquired from a registry.
Implementation notes:
Declared as a runtime exception because ordinary use of
singletons and singleton registries are assumed to be correct
by the context using them. The context, for example, should
never test for a null return value from a registry, because
either the singleton instance exist or it does not; a null
value does not make any sense, and would constitute a poor design
decision. Hence, in the general case, the context should not
have to worry about checked exceptions as they would never
be thrown.
The singleton creation could fail, of cause, but that is of no concern to the registry as it will simply re-throw such errors wrapped in this exception type.
Field Summary | |
---|---|
(package private) static long |
serialVersionUID
Serial version id. |
Constructor Summary | |
---|---|
SingletonException()
No-arg constructor. |
|
SingletonException(Class<?> type)
Constructor. |
|
SingletonException(String message)
Constructor. |
|
SingletonException(Throwable cause)
Constructor. |
Method Summary |
---|
Methods inherited from class java.lang.Throwable |
---|
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
static final long serialVersionUID
Constructor Detail |
---|
public SingletonException()
public SingletonException(Class<?> type)
type
- The faulting type; can be null.public SingletonException(String message)
message
- The detail message; can be null.public SingletonException(Throwable cause)
cause
- The causing throwable; can be null.
|
Gunni Rode / rode.dk | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |