Class CsvDataTypeMismatchException

  • All Implemented Interfaces:
    java.io.Serializable

    public class CsvDataTypeMismatchException
    extends CsvException
    This exception should be thrown when the provided string value for conversion cannot be converted to the required type of the destination field.
    Since:
    3.8
    Author:
    Andrew Rucker Jones
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      CsvDataTypeMismatchException()
      Default constructor, in case no further information is necessary or available.
      CsvDataTypeMismatchException​(java.lang.Object sourceObject, java.lang.Class<?> destinationClass)
      Constructor for setting the data and the class of the intended destination field.
      CsvDataTypeMismatchException​(java.lang.Object sourceObject, java.lang.Class<?> destinationClass, java.lang.String message)
      Constructor for setting the data and the class of the intended destination field along with an error message.
      CsvDataTypeMismatchException​(java.lang.String message)
      Constructor with a simple text.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.Class<?> getDestinationClass()
      Gets the type of the field to which the data were to be assigned.
      java.lang.Object getSourceObject()
      Gets the object that was to be assigned to a field of the wrong type.
      • Methods inherited from class java.lang.Throwable

        addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • CsvDataTypeMismatchException

        public CsvDataTypeMismatchException()
        Default constructor, in case no further information is necessary or available.
      • CsvDataTypeMismatchException

        public CsvDataTypeMismatchException​(java.lang.Object sourceObject,
                                            java.lang.Class<?> destinationClass)
        Constructor for setting the data and the class of the intended destination field.
        Parameters:
        sourceObject - Object that was to be assigned to the destination field. This may not be available in all contexts.
        destinationClass - Class of the destination field. This may not be available in all contexts.
      • CsvDataTypeMismatchException

        public CsvDataTypeMismatchException​(java.lang.String message)
        Constructor with a simple text.
        Parameters:
        message - Human-readable error text
      • CsvDataTypeMismatchException

        public CsvDataTypeMismatchException​(java.lang.Object sourceObject,
                                            java.lang.Class<?> destinationClass,
                                            java.lang.String message)
        Constructor for setting the data and the class of the intended destination field along with an error message.
        Parameters:
        sourceObject - Object that was to be assigned to the destination field. This may not be available in all contexts.
        destinationClass - Class of the destination field. This may not be available in all contexts.
        message - Human-readable error text
    • Method Detail

      • getSourceObject

        public java.lang.Object getSourceObject()
        Gets the object that was to be assigned to a field of the wrong type. sourceObject is marked transient, because Object is not Serializable. If for any reason this exception is serialized and deserialized, this method will subsequently return null.
        Returns:
        The data that could not be assigned
      • getDestinationClass

        public java.lang.Class<?> getDestinationClass()
        Gets the type of the field to which the data were to be assigned.
        Returns:
        The class of the destination field