Class GroovyCastException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
java.lang.ClassCastException
org.codehaus.groovy.runtime.typehandling.GroovyCastException
- All Implemented Interfaces:
Serializable
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.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionGroovyCastException(Object objectToCast, Class classToCastTo) Constructs a GroovyCastException with details of the failed cast.GroovyCastException(Object objectToCast, Class classToCastTo, Exception cause) Constructs a GroovyCastException with details of the failed cast and its cause.GroovyCastException(String message) Constructs a GroovyCastException with a custom error message. -
Method Summary
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
GroovyCastException
Constructs a GroovyCastException with details of the failed cast and its cause.- Parameters:
objectToCast- the object that failed to castclassToCastTo- the target classcause- the underlying exception (message is included in the error)
-
GroovyCastException
Constructs a GroovyCastException with details of the failed cast.- Parameters:
objectToCast- the object that failed to castclassToCastTo- the target class
-
GroovyCastException
Constructs a GroovyCastException with a custom error message.- Parameters:
message- the error message
-