Class MapTypeMismatchException

All Implemented Interfaces:
Serializable

public class MapTypeMismatchException extends RuntimeException
Exception thrown when a value in a Map cannot be cast to the expected type.
See Also:
  • Constructor Details

    • MapTypeMismatchException

      public MapTypeMismatchException()
      Constructs a new instance with no detail message.
    • MapTypeMismatchException

      public MapTypeMismatchException(String message)
      Constructs a new instance with the specified detail message.
      Parameters:
      message - the detail message
    • MapTypeMismatchException

      public MapTypeMismatchException(String message, Throwable cause)
      Constructs a new instance with the specified detail message and cause.
      Parameters:
      message - the detail message
      cause - the cause
    • MapTypeMismatchException

      public MapTypeMismatchException(Throwable cause)
      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 type
      valueType - the expected type of the value
      cause - the ClassCastException that occurred during the cast attempt
      Returns:
      a new instance with a descriptive message