Top Description Fields Constructors Methods
com.opencsv.exceptions

public Class CsvRequiredFieldEmptyException

extends CsvFieldAssignmentException
Class Inheritance
Imports
java.lang.reflect.Field, java.util.Collections, .List, org.apache.commons.collections4.CollectionUtils, org.apache.commons.collections4.list.UnmodifiableList

This exception should be thrown when a field marked as required is empty in the CSV file.
Author
Andrew Rucker Jones
Since
3.8

Field Summary

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

Constructor Summary

AccessConstructor and Description
public
CsvRequiredFieldEmptyException()

Default constructor, in case no further information is necessary.

public
CsvRequiredFieldEmptyException(String
Human-readable error text
message
)

Constructor with a simple text.

public
CsvRequiredFieldEmptyException(Class<?>
Class of the destination bean
beanClass
,
Field
Field of the destination field in the destination bean
destinationField
)

Constructor for setting the intended class and field of the target bean.

public
CsvRequiredFieldEmptyException(Class<?>
Class of the destination bean
beanClass
,
List<Field>
Fields of the destination fields in the destination bean
destinationFields
)

Constructor for setting the intended class and fields of the target bean.

public
CsvRequiredFieldEmptyException(Class<?>
Class of the destination bean
beanClass
,
String
Human-readable error text
message
)

Constructor for setting the intended class of the target bean and a human-readable error message.

public
CsvRequiredFieldEmptyException(Class<?>
Class of the destination bean
beanClass
,
Field
Field of the destination field in the destination bean
destinationField
,
String
Human-readable error text
message
)

Constructor for setting the intended class and field of the target bean along with an error message.

public
CsvRequiredFieldEmptyException(Class<?>
Class of the destination bean
beanClass
,
List<Field>
Field of the destination field in the destination bean
destinationFields
,
String
Human-readable error text
message
)

Constructor for setting the intended class and fields of the target bean along with an error message.

Method Summary

Modifier and TypeMethod and Description
public Class<?>

Returns:

The class of the bean to which the destination field belongs
getBeanClass
()

Gets the class of the bean to which the value was to be assigned.

public Field

Returns:

The first destination field that was to receive the empty value
getDestinationField
()

Gets the field from the Reflection API that was to be assigned.

public List<Field>

Returns:

All destination fields that were to receive the empty value
getDestinationFields
()

Returns the complete list of all fields that were to be empty.

Field Detail

beanClassback to summary
private final Class<?> beanClass
destinationFieldsback to summary
private final transient List<Field> destinationFields
serialVersionUIDback to summary
private static final long serialVersionUID

Hides com.opencsv.exceptions.CsvException.serialVersionUID.

Constructor Detail

CsvRequiredFieldEmptyExceptionback to summary
public CsvRequiredFieldEmptyException()

Default constructor, in case no further information is necessary.

CsvRequiredFieldEmptyExceptionback to summary
public CsvRequiredFieldEmptyException(String message)

Constructor with a simple text.

Parameters
message:String

Human-readable error text

CsvRequiredFieldEmptyExceptionback to summary
public CsvRequiredFieldEmptyException(Class<?> beanClass, Field destinationField)

Constructor for setting the intended class and field of the target bean.

These may not be known in every context.

This constructor is provided for backward compatibility and for convenience if you only have one missing destination field.

Parameters
beanClass:Class<?>

Class of the destination bean

destinationField:Field

Field of the destination field in the destination bean

CsvRequiredFieldEmptyExceptionback to summary
public CsvRequiredFieldEmptyException(Class<?> beanClass, List<Field> destinationFields)

Constructor for setting the intended class and fields of the target bean. These may not be known in every context.

Parameters
beanClass:Class<?>

Class of the destination bean

destinationFields:List<Field>

Fields of the destination fields in the destination bean

Since
4.2
CsvRequiredFieldEmptyExceptionback to summary
public CsvRequiredFieldEmptyException(Class<?> beanClass, String message)

Constructor for setting the intended class of the target bean and a human-readable error message. These may not be known in every context.

Parameters
beanClass:Class<?>

Class of the destination bean

message:String

Human-readable error text

Since
3.10
CsvRequiredFieldEmptyExceptionback to summary
public CsvRequiredFieldEmptyException(Class<?> beanClass, Field destinationField, String message)

Constructor for setting the intended class and field of the target bean along with an error message.

The class and field may not be known in every context.

This constructor is provided for backward compatibility and for convenience if you only have one missing destination field.

Parameters
beanClass:Class<?>

Class of the destination bean

destinationField:Field

Field of the destination field in the destination bean

message:String

Human-readable error text

CsvRequiredFieldEmptyExceptionback to summary
public CsvRequiredFieldEmptyException(Class<?> beanClass, List<Field> destinationFields, String message)

Constructor for setting the intended class and fields of the target bean along with an error message. The class and field may not be known in every context.

Parameters
beanClass:Class<?>

Class of the destination bean

destinationFields:List<Field>

Field of the destination field in the destination bean

message:String

Human-readable error text

Since
4.2

Method Detail

getBeanClassback to summary
public Class<?> getBeanClass()

Gets the class of the bean to which the value was to be assigned.

Returns:Class<?>

The class of the bean to which the destination field belongs

getDestinationFieldback to summary
public Field getDestinationField()

Gets the field from the Reflection API that was to be assigned.

This method is provided as a convenience for when you know there can be only one field, or you really only care about the first field.

destinationFields is marked transient, because java.lang.reflect.Field is not java.io.Serializable. If for any reason this exception is serialized and deserialized, this method will subsequently return null.

Returns:Field

The first destination field that was to receive the empty value

getDestinationFieldsback to summary
public List<Field> getDestinationFields()

Returns the complete list of all fields that were to be empty. destinationFields is marked transient, because java.lang.reflect.Field is not java.io.Serializable. If for any reason this exception is serialized and deserialized, this method will subsequently return null.

Returns:List<Field>

All destination fields that were to receive the empty value

Since
4.2