Class CsvRequiredFieldEmptyException

  • All Implemented Interfaces:
    java.io.Serializable

    public class CsvRequiredFieldEmptyException
    extends CsvException
    This exception should be thrown when a field marked as required is empty in the CSV file.
    Since:
    3.8
    Author:
    Andrew Rucker Jones
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      CsvRequiredFieldEmptyException()
      Default constructor, in case no further information is necessary.
      CsvRequiredFieldEmptyException​(java.lang.Class<?> beanClass, java.lang.reflect.Field destinationField)
      Constructor for setting the intended class and field of the target bean.
      CsvRequiredFieldEmptyException​(java.lang.Class<?> beanClass, java.lang.reflect.Field destinationField, java.lang.String message)
      Constructor for setting the intended class and field of the target bean along with an error message.
      CsvRequiredFieldEmptyException​(java.lang.Class<?> beanClass, java.lang.String message)
      Constructor for setting the intended class of the target bean and a human-readable error message.
      CsvRequiredFieldEmptyException​(java.lang.Class<?> beanClass, java.util.List<java.lang.reflect.Field> destinationFields)
      Constructor for setting the intended class and fields of the target bean.
      CsvRequiredFieldEmptyException​(java.lang.Class<?> beanClass, java.util.List<java.lang.reflect.Field> destinationFields, java.lang.String message)
      Constructor for setting the intended class and fields of the target bean along with an error message.
      CsvRequiredFieldEmptyException​(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<?> getBeanClass()
      Gets the class of the bean to which the value was to be assigned.
      java.lang.reflect.Field getDestinationField()
      Gets the field from the Reflection API that was to be assigned.
      java.util.List<java.lang.reflect.Field> getDestinationFields()
      Returns the complete list of all fields that were to be empty.
      • 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

      • CsvRequiredFieldEmptyException

        public CsvRequiredFieldEmptyException()
        Default constructor, in case no further information is necessary.
      • CsvRequiredFieldEmptyException

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

        public CsvRequiredFieldEmptyException​(java.lang.Class<?> beanClass,
                                              java.lang.reflect.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 of the destination bean
        destinationField - Field of the destination field in the destination bean
      • CsvRequiredFieldEmptyException

        public CsvRequiredFieldEmptyException​(java.lang.Class<?> beanClass,
                                              java.util.List<java.lang.reflect.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 of the destination bean
        destinationFields - Fields of the destination fields in the destination bean
        Since:
        4.2
      • CsvRequiredFieldEmptyException

        public CsvRequiredFieldEmptyException​(java.lang.Class<?> beanClass,
                                              java.lang.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 of the destination bean
        message - Human-readable error text
        Since:
        3.10
      • CsvRequiredFieldEmptyException

        public CsvRequiredFieldEmptyException​(java.lang.Class<?> beanClass,
                                              java.lang.reflect.Field destinationField,
                                              java.lang.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 of the destination bean
        destinationField - Field of the destination field in the destination bean
        message - Human-readable error text
      • CsvRequiredFieldEmptyException

        public CsvRequiredFieldEmptyException​(java.lang.Class<?> beanClass,
                                              java.util.List<java.lang.reflect.Field> destinationFields,
                                              java.lang.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 of the destination bean
        destinationFields - Field of the destination field in the destination bean
        message - Human-readable error text
        Since:
        4.2
    • Method Detail

      • getBeanClass

        public java.lang.Class<?> getBeanClass()
        Gets the class of the bean to which the value was to be assigned.
        Returns:
        The class of the bean to which the destination field belongs
      • getDestinationField

        public java.lang.reflect.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 Field is not Serializable. If for any reason this exception is serialized and deserialized, this method will subsequently return null.

        Returns:
        The first destination field that was to receive the empty value
      • getDestinationFields

        public java.util.List<java.lang.reflect.Field> getDestinationFields()
        Returns the complete list of all fields that were to be empty. destinationFields is marked transient, because Field is not Serializable. If for any reason this exception is serialized and deserialized, this method will subsequently return null.
        Returns:
        All destination fields that were to receive the empty value
        Since:
        4.2