public class CastException extends FatalException
An exception thrown when an attempt is made to type-cast an object to a type that the object is not a member of.
Modifier | Constructor and Description |
---|---|
|
CastException()
Default constructor.
|
protected |
CastException(java.lang.String message,
java.lang.Throwable cause) |
Modifier and Type | Method and Description |
---|---|
static CastException |
cannotCast(java.lang.Object value,
java.lang.String type)
Return a CastException indicating that
value cannot be cast to type . |
static CastException |
withMessage(java.lang.String message)
Return a new exception with the specified message text.
|
getCause, getMessage, setCause, setMessage, toString
protected CastException(java.lang.String message, java.lang.Throwable cause)
public CastException()
Default constructor.
public static CastException cannotCast(java.lang.Object value, java.lang.String type)
Return a CastException indicating that value
cannot be cast to type
.
value
- (nullable) Any value, including null
.type
- Cast target type.value
cannot be cast to type
.public static CastException withMessage(java.lang.String message)
Return a new exception with the specified message text.
message
- Message text.