BeanIO 2.0.4

org.beanio
Class BeanReaderException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by java.lang.RuntimeException
              extended by org.beanio.BeanIOException
                  extended by org.beanio.BeanReaderException
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
BeanReaderIOException, InvalidRecordException, MalformedRecordException, UnexpectedRecordException, UnidentifiedRecordException

public class BeanReaderException
extends BeanIOException

Exception thrown by a BeanReader or Unmarshaller.

In most cases, a subclass of this exception is thrown. In a few (but rare) fatal cases, this exception may be thrown directly.

Since:
1.0
Author:
Kevin Seim
See Also:
BeanReader, Serialized Form

Constructor Summary
BeanReaderException(String message)
          Constructs a new BeanReaderException.
BeanReaderException(String message, Throwable cause)
          Constructs a new BeanReaderException.
 
Method Summary
 RecordContext getContext()
          Deprecated. use getRecordContext()
 RecordContext getRecordContext()
          Returns the record context that caused the error.
 RecordContext getRecordContext(int index)
          Returns the record context for a given record index.
 int getRecordCount()
          Returns the number of unmarshalled records with context information available if getRecordContext(int) is called.
protected  void setRecordContext(RecordContext recordContext)
          Sets the record context that caused the exception.
protected  void setRecordContext(RecordContext[] recordContext)
          Sets the record context(s) that caused the exception.
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, 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

BeanReaderException

public BeanReaderException(String message)
Constructs a new BeanReaderException.

Parameters:
message - the error message

BeanReaderException

public BeanReaderException(String message,
                           Throwable cause)
Constructs a new BeanReaderException.

Parameters:
message - the error message
cause - the root cause
Method Detail

getRecordCount

public int getRecordCount()
Returns the number of unmarshalled records with context information available if getRecordContext(int) is called.

Returns:
the unmarshalled record count

getContext

public RecordContext getContext()
Deprecated. use getRecordContext()

Returns the record context that caused the error. May be null if there is no context information associated with the exception. If there is more than one record context, this method returns the context of the first record and is equivalent to calling getRecordContext(0).

Returns:
the RecordContext
Since:
2.0

getRecordContext

public RecordContext getRecordContext()
Returns the record context that caused the error. May be null if there is no context information associated with the exception. If there is more than one record context, this method returns the context of the first record and is equivalent to calling getRecordContext(0).

Returns:
the RecordContext
Since:
2.0
See Also:
getRecordContext(int)

getRecordContext

public RecordContext getRecordContext(int index)
                               throws IndexOutOfBoundsException
Returns the record context for a given record index. The first record uses index 0.

Parameters:
index - the record index
Returns:
the RecordContext
Throws:
IndexOutOfBoundsException - if there is no record for the given index
Since:
2.0
See Also:
getRecordCount()

setRecordContext

protected void setRecordContext(RecordContext recordContext)
Sets the record context that caused the exception. This method simply wraps the supplied context in an array and invokes setRecordContext(RecordContext[]).

Parameters:
recordContext - the RecordContext
Since:
2.0

setRecordContext

protected void setRecordContext(RecordContext[] recordContext)
Sets the record context(s) that caused the exception.

Parameters:
recordContext - the array of RecordContext
Since:
2.0

BeanIO 2.0.4

Copyright © 2010-2013 Kevin Seim