Package org.kiwiproject.collect
Class MapTypeMismatchException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
org.kiwiproject.collect.MapTypeMismatchException
- All Implemented Interfaces:
Serializable
Exception thrown when a value in a
Map cannot be cast to the expected type.- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs a new instance with no detail message.MapTypeMismatchException(String message) Constructs a new instance with the specified detail message.MapTypeMismatchException(String message, Throwable cause) Constructs a new instance with the specified detail message and cause.Constructs a new instance with the specified cause and a detail message of(cause==null ? null : cause.toString()). -
Method Summary
Modifier and TypeMethodDescriptionstatic MapTypeMismatchExceptionforTypeMismatch(Object key, Class<?> valueType, ClassCastException cause) Factory method to create a new instance with a standardized message for a type mismatch.Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
MapTypeMismatchException
public MapTypeMismatchException()Constructs a new instance with no detail message. -
MapTypeMismatchException
Constructs a new instance with the specified detail message.- Parameters:
message- the detail message
-
MapTypeMismatchException
Constructs a new instance with the specified detail message and cause.- Parameters:
message- the detail messagecause- the cause
-
MapTypeMismatchException
Constructs a new instance with the specified cause and a detail message of(cause==null ? null : cause.toString()).- Parameters:
cause- the cause
-
-
Method Details
-
forTypeMismatch
public static MapTypeMismatchException forTypeMismatch(Object key, Class<?> valueType, ClassCastException cause) Factory method to create a new instance with a standardized message for a type mismatch.- Parameters:
key- the map key whose value could not be cast to the expected typevalueType- the expected type of the valuecause- the ClassCastException that occurred during the cast attempt- Returns:
- a new instance with a descriptive message
-