Class CsvBeanIntrospectionException

All Implemented Interfaces:
Serializable

public class CsvBeanIntrospectionException extends CsvRuntimeException
This exception is to be thrown when anything goes bad during introspection of beans given to opencsv. It encapsulates exceptions such as NoSuchMethodException, IllegalAccessException and InvocationTargetException. Some might notice that this effectively converts checked exceptions into unchecked exceptions. Introspection exceptions are coding errors that should be fixed during development, and should not have to be handled in production code.
Since:
3.9
See Also:
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      See Also:
    • bean

      private final transient Object bean
      The bean that was acted upon.
    • field

      private final transient Field field
      The field that was supposed to be manipulated in the bean.
  • Constructor Details

    • CsvBeanIntrospectionException

      public CsvBeanIntrospectionException()
      Nullary constructor.
    • CsvBeanIntrospectionException

      public CsvBeanIntrospectionException(String message)
      Constructor with a human-readable error message.
      Parameters:
      message - Error message
    • CsvBeanIntrospectionException

      public CsvBeanIntrospectionException(Object bean, Field field)
      Constructor to specify the bean and field whose manipulation caused this exception.
      Parameters:
      bean - The bean that was to be manipulated
      field - The field in the bean
    • CsvBeanIntrospectionException

      public CsvBeanIntrospectionException(Object bean, Field field, String message)
      Constructor to provide all information connected to the error raised.
      Parameters:
      bean - The bean that was to be manipulated
      field - The field in the bean
      message - Error message
  • Method Details

    • getMessage

      public String getMessage()
      Gets a human-readable error message.
      Overrides:
      getMessage in class Throwable
      Returns:
      The error message, or if none is found, but bean and field have been set, returns a default error message incorporating the names of bean and field
    • getLocalizedMessage

      public String getLocalizedMessage()
      Overrides:
      getLocalizedMessage in class Throwable
    • getMessageFromLocale

      private String getMessageFromLocale(Locale locale)
    • getBean

      public Object getBean()
      Gets the bean that was to be introspected. bean 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 bean that caused this exception
    • getField

      public Field getField()
      Gets the field from the Reflection API that was involved in the error. field 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 field in the bean that caused this exception