public class GroovyCastException
extends ClassCastException
Exception thrown when a type cast or coercion fails.
This exception provides detailed information about the object that failed to cast, the target type, and any underlying cause. The error messages suggest alternative wrapper types when casting to primitive wrapper classes.
| Constructor and description |
|---|
GroovyCastException(Object objectToCast, Class classToCastTo, Exception cause)Constructs a GroovyCastException with details of the failed cast and its cause. |
GroovyCastException(Object objectToCast, Class classToCastTo)Constructs a GroovyCastException with details of the failed cast. |
GroovyCastException(String message)Constructs a GroovyCastException with a custom error message. |
| Methods inherited from class | Name |
|---|---|
class ClassCastException |
addSuppressed, equals, fillInStackTrace, getCause, getClass, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, hashCode, initCause, notify, notifyAll, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString, wait, wait, wait |
Constructs a GroovyCastException with details of the failed cast and its cause.
objectToCast - the object that failed to castclassToCastTo - the target classcause - the underlying exception (message is included in the error)Constructs a GroovyCastException with details of the failed cast.
objectToCast - the object that failed to castclassToCastTo - the target classConstructs a GroovyCastException with a custom error message.
message - the error messageCopyright © 2003-2026 The Apache Software Foundation. All rights reserved.