Package com.opencsv.exceptions
Class CsvDataTypeMismatchException
java.lang.Object
java.lang.Throwable
java.lang.Exception
com.opencsv.exceptions.CsvException
com.opencsv.exceptions.CsvFieldAssignmentException
com.opencsv.exceptions.CsvDataTypeMismatchException
- All Implemented Interfaces:
Serializable
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
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor, in case no further information is necessary or available.CsvDataTypeMismatchException
(Object sourceObject, Class<?> destinationClass) Constructor for setting the data and the class of the intended destination field.CsvDataTypeMismatchException
(Object sourceObject, Class<?> destinationClass, String message) Constructor for setting the data and the class of the intended destination field along with an error message.CsvDataTypeMismatchException
(String message) Constructor with a simple text. -
Method Summary
Modifier and TypeMethodDescriptionClass
<?> Gets the type of the field to which the data were to be assigned.Gets the object that was to be assigned to a field of the wrong type.Methods inherited from class com.opencsv.exceptions.CsvException
getLine, getLineNumber, setLine, setLineNumber
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
sourceObject
-
destinationClass
-
-
Constructor Details
-
CsvDataTypeMismatchException
public CsvDataTypeMismatchException()Default constructor, in case no further information is necessary or available. -
CsvDataTypeMismatchException
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
Constructor with a simple text.- Parameters:
message
- Human-readable error text
-
CsvDataTypeMismatchException
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 Details
-
getSourceObject
Gets the object that was to be assigned to a field of the wrong type.sourceObject
is markedtransient
, becauseObject
is notSerializable
. If for any reason this exception is serialized and deserialized, this method will subsequently returnnull
.- Returns:
- The data that could not be assigned
-
getDestinationClass
Gets the type of the field to which the data were to be assigned.- Returns:
- The class of the destination field
-