Class TypeConversionException

All Implemented Interfaces:
Serializable
Direct Known Subclasses:
StreamCacheException

public class TypeConversionException extends RuntimeCamelException
Unchecked exception thrown when a type converter is found but fails to convert a value to the required type.

Contrast with NoTypeConversionAvailableException, which is thrown when no converter exists for the source-to-target type pair at all.

See Also:
  • Constructor Details

    • TypeConversionException

      public TypeConversionException(@Nullable Object value, Class<?> type, Throwable cause)
      Parameters:
      value - the value that could not be converted
      type - the expected target type
      cause - the cause of the failure
  • Method Details

    • getValue

      public @Nullable Object getValue()
      Returns the value which could not be converted
    • getToType

      public Class<?> getToType()
      Returns the required to type
    • getFromType

      public @Nullable Class<?> getFromType()
      Returns the required from type. Returns null if the provided value was null.
    • createMessage

      public static String createMessage(@Nullable Object value, Class<?> type, Throwable cause)
      Returns an error message for type conversion failed.