Package com.opencsv.exceptions
Class CsvChainedException
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- com.opencsv.exceptions.CsvException
-
- com.opencsv.exceptions.CsvChainedException
-
- All Implemented Interfaces:
java.io.Serializable
public class CsvChainedException extends CsvException
An exception class for collecting multiple exceptions. For internal use only.- Since:
- 5.3
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<CsvFieldAssignmentException>
exceptionChain
-
Constructor Summary
Constructors Constructor Description CsvChainedException(CsvFieldAssignmentException csve)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(CsvFieldAssignmentException csve)
Add an exception to the chain of collections.java.util.List<CsvFieldAssignmentException>
getExceptionChain()
CsvFieldAssignmentException
getFirstException()
Convenience method to return the first exception from the exception chain.boolean
hasOnlyOneException()
Convenience method that checks if the chain only has a single exception.void
setLine(java.lang.String[] line)
Sets the line for all exceptions collected.void
setLineNumber(long lineNumber)
Sets the line number for all exceptions collected.-
Methods inherited from class com.opencsv.exceptions.CsvException
getLine, getLineNumber
-
-
-
-
Field Detail
-
exceptionChain
private final java.util.List<CsvFieldAssignmentException> exceptionChain
-
-
Constructor Detail
-
CsvChainedException
public CsvChainedException(CsvFieldAssignmentException csve)
Constructor.- Parameters:
csve
- The first exception for the list being collected. Must not benull
.
-
-
Method Detail
-
add
public void add(CsvFieldAssignmentException csve)
Add an exception to the chain of collections.- Parameters:
csve
- Exception to be added to this chain. Must not benull
.
-
getExceptionChain
public java.util.List<CsvFieldAssignmentException> getExceptionChain()
- Returns:
- A list of all exceptions collected
-
setLine
public void setLine(java.lang.String[] line)
Sets the line for all exceptions collected.- Overrides:
setLine
in classCsvException
- Parameters:
line
- The line that caused the error on reading. May benull
.
-
setLineNumber
public void setLineNumber(long lineNumber)
Sets the line number for all exceptions collected.- Overrides:
setLineNumber
in classCsvException
- Parameters:
lineNumber
- The line number that caused the error. This should be the one-based number of the line that caused the error, not including the header line, if present.
-
hasOnlyOneException
public boolean hasOnlyOneException()
Convenience method that checks if the chain only has a single exception.- Returns:
true
if chain has only a single exception,false
otherwise
-
getFirstException
public CsvFieldAssignmentException getFirstException()
Convenience method to return the first exception from the exception chain.- Returns:
CsvFieldAssignmentException
at the first position in the list,null
otherwise.
-
-