Top Description Fields Constructors Methods
com.opencsv.exceptions

public Class CsvDataTypeMismatchException

extends CsvFieldAssignmentException
Class Inheritance

This exception should be thrown when the provided string value for conversion cannot be converted to the required type of the destination field.
Author
Andrew Rucker Jones
Since
3.8

Field Summary

Modifier and TypeField and Description
private final Class<?>
private static final long
private final transient Object

Constructor Summary

AccessConstructor and Description
public
CsvDataTypeMismatchException()

Default constructor, in case no further information is necessary or available.

public
CsvDataTypeMismatchException(Object
Object that was to be assigned to the destination field. This may not be available in all contexts.
sourceObject
,
Class<?>
Class of the destination field. This may not be available in all contexts.
destinationClass
)

Constructor for setting the data and the class of the intended destination field.

public
CsvDataTypeMismatchException(String
Human-readable error text
message
)

Constructor with a simple text.

public
CsvDataTypeMismatchException(Object
Object that was to be assigned to the destination field. This may not be available in all contexts.
sourceObject
,
Class<?>
Class of the destination field. This may not be available in all contexts.
destinationClass
,
String
Human-readable error text
message
)

Constructor for setting the data and the class of the intended destination field along with an error message.

Method Summary

Modifier and TypeMethod and Description
public Class<?>

Returns:

The class of the destination field
getDestinationClass
()

Gets the type of the field to which the data were to be assigned.

public Object

Returns:

The data that could not be assigned
getSourceObject
()

Gets the object that was to be assigned to a field of the wrong type.

Field Detail

destinationClassback to summary
private final Class<?> destinationClass
serialVersionUIDback to summary
private static final long serialVersionUID

Hides com.opencsv.exceptions.CsvException.serialVersionUID.

sourceObjectback to summary
private final transient Object sourceObject

Constructor Detail

CsvDataTypeMismatchExceptionback to summary
public CsvDataTypeMismatchException()

Default constructor, in case no further information is necessary or available.

CsvDataTypeMismatchExceptionback to summary
public CsvDataTypeMismatchException(Object sourceObject, Class<?> destinationClass)

Constructor for setting the data and the class of the intended destination field.

Parameters
sourceObject:Object

Object that was to be assigned to the destination field. This may not be available in all contexts.

destinationClass:Class<?>

Class of the destination field. This may not be available in all contexts.

CsvDataTypeMismatchExceptionback to summary
public CsvDataTypeMismatchException(String message)

Constructor with a simple text.

Parameters
message:String

Human-readable error text

CsvDataTypeMismatchExceptionback to summary
public 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.

Parameters
sourceObject:Object

Object that was to be assigned to the destination field. This may not be available in all contexts.

destinationClass:Class<?>

Class of the destination field. This may not be available in all contexts.

message:String

Human-readable error text

Method Detail

getDestinationClassback to summary
public Class<?> getDestinationClass()

Gets the type of the field to which the data were to be assigned.

Returns:Class<?>

The class of the destination field

getSourceObjectback to summary
public Object getSourceObject()

Gets the object that was to be assigned to a field of the wrong type. sourceObject is marked transient, because java.lang.Object is not java.io.Serializable. If for any reason this exception is serialized and deserialized, this method will subsequently return null.

Returns:Object

The data that could not be assigned