Package com.opencsv.exceptions
Class CsvBeanIntrospectionException
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- java.lang.RuntimeException
-
- com.opencsv.exceptions.CsvRuntimeException
-
- com.opencsv.exceptions.CsvBeanIntrospectionException
-
- All Implemented Interfaces:
java.io.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 asNoSuchMethodException
,IllegalAccessException
andInvocationTargetException
. 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:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.Object
bean
The bean that was acted upon.private java.lang.reflect.Field
field
The field that was supposed to be manipulated in the bean.private static long
serialVersionUID
-
Constructor Summary
Constructors Constructor Description CsvBeanIntrospectionException()
Nullary constructor.CsvBeanIntrospectionException(java.lang.Object bean, java.lang.reflect.Field field)
Constructor to specify the bean and field whose manipulation caused this exception.CsvBeanIntrospectionException(java.lang.Object bean, java.lang.reflect.Field field, java.lang.String message)
Constructor to provide all information connected to the error raised.CsvBeanIntrospectionException(java.lang.String message)
Constructor with a human-readable error message.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Object
getBean()
Gets the bean that was to be introspected.java.lang.reflect.Field
getField()
Gets the field from the Reflection API that was involved in the error.java.lang.String
getLocalizedMessage()
java.lang.String
getMessage()
Gets a human-readable error message.private java.lang.String
getMessageFromLocale(java.util.Locale locale)
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
bean
private final transient java.lang.Object bean
The bean that was acted upon.
-
field
private final transient java.lang.reflect.Field field
The field that was supposed to be manipulated in the bean.
-
-
Constructor Detail
-
CsvBeanIntrospectionException
public CsvBeanIntrospectionException()
Nullary constructor.
-
CsvBeanIntrospectionException
public CsvBeanIntrospectionException(java.lang.String message)
Constructor with a human-readable error message.- Parameters:
message
- Error message
-
CsvBeanIntrospectionException
public CsvBeanIntrospectionException(java.lang.Object bean, java.lang.reflect.Field field)
Constructor to specify the bean and field whose manipulation caused this exception.- Parameters:
bean
- The bean that was to be manipulatedfield
- The field in the bean
-
CsvBeanIntrospectionException
public CsvBeanIntrospectionException(java.lang.Object bean, java.lang.reflect.Field field, java.lang.String message)
Constructor to provide all information connected to the error raised.- Parameters:
bean
- The bean that was to be manipulatedfield
- The field in the beanmessage
- Error message
-
-
Method Detail
-
getMessage
public java.lang.String getMessage()
Gets a human-readable error message.
-
getLocalizedMessage
public java.lang.String getLocalizedMessage()
- Overrides:
getLocalizedMessage
in classjava.lang.Throwable
-
getMessageFromLocale
private java.lang.String getMessageFromLocale(java.util.Locale locale)
-
getBean
public java.lang.Object getBean()
Gets the bean that was to be introspected.bean
is markedtransient
, becauseObject
is notSerializable
. If for any reason this exception is serialized and deserialized, this method will subsequently returnnull
.- Returns:
- The bean that caused this exception
-
getField
public java.lang.reflect.Field getField()
Gets the field from the Reflection API that was involved in the error.field
is markedtransient
, becauseField
is notSerializable
. If for any reason this exception is serialized and deserialized, this method will subsequently returnnull
.- Returns:
- The field in the bean that caused this exception
-
-