Package org.beanio

Class BeanReaderException

    • Constructor Detail

      • BeanReaderException

        public BeanReaderException​(java.lang.String message)
        Constructs a new BeanReaderException.
        Parameters:
        message - the error message
      • BeanReaderException

        public BeanReaderException​(java.lang.String message,
                                   java.lang.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

        @Deprecated
        public RecordContext getContext()
        Deprecated.
        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 java.lang.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:
        java.lang.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