| 
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectjava.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
java.lang.IllegalArgumentException
org.apache.commons.lang.IllegalClassException
Thrown when an object is an instance of an unexpected type (a class or interface).
 This exception supplements the standard IllegalArgumentException
 by providing a more semantically rich description of the problem.
IllegalClassException represents the case where a method takes
 in a genericly typed parameter like Object (typically because it has to due to some
 other interface it implements), but this implementation only actually accepts a specific
 type, for example String. This exception would be used in place of
 IllegalArgumentException, yet it still extends it.
 public void foo(Object obj) {
   if (obj instanceof String == false) {
     throw new IllegalClassException(String.class, obj);
   }
   // do something with the string
 }
 
| Constructor Summary | |
IllegalClassException(Class expected,
                      Class actual)
Instantiates with the expected and actual types.  | 
|
IllegalClassException(Class expected,
                      Object actual)
Instantiates with the expected type, and actual object.  | 
|
IllegalClassException(String message)
Instantiates with the specified message.  | 
|
| 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 | 
| Constructor Detail | 
public IllegalClassException(Class expected,
                             Object actual)
Instantiates with the expected type, and actual object.
expected - the expected typeactual - the actual object
public IllegalClassException(Class expected,
                             Class actual)
Instantiates with the expected and actual types.
expected - the expected typeactual - the actual typepublic IllegalClassException(String message)
Instantiates with the specified message.
message - the exception message
  | 
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||