BeanIO 1.2.3

org.beanio
Interface BeanReaderContext


public interface BeanReaderContext

When a BeanReaderException is thrown, all errors and the current state of the BeanReader can be accessed from the BeanReaderContext. Depending on the type of exception, some information may be missing.

Since:
1.0
Author:
Kevin Seim
See Also:
BeanReaderException

Method Summary
 Map<String,Collection<String>> getFieldErrors()
          Returns a Map of all field errors, where the Map key is the field name.
 Collection<String> getFieldErrors(String fieldName)
          Returns the field errors for a given field.
 String getFieldText(String fieldName)
          Returns the unparsed text of a field from the record.
 String getFieldText(String fieldName, int index)
          Returns the unparsed text of a field from the record.
 Collection<String> getRecordErrors()
          Returns the collection of record level error messages.
 int getRecordLineNumber()
          Returns the line number of the failed record, or 0 if the stream does not use new lines to terminate records.
 String getRecordName()
          Returns the name of the record from the stream configuration.
 String getRecordText()
          Returns the raw text of the record being parsed, or null if not supported by the input stream format (such as XML).
 boolean hasFieldErrors()
          Returns true if there are one or more field level errors.
 boolean hasRecordErrors()
          Returns true if there are one or more record level errors.
 

Method Detail

getRecordLineNumber

int getRecordLineNumber()
Returns the line number of the failed record, or 0 if the stream does not use new lines to terminate records.

Returns:
the line number of the failed record

getRecordText

String getRecordText()
Returns the raw text of the record being parsed, or null if not supported by the input stream format (such as XML).

Returns:
the raw text of the record

getRecordName

String getRecordName()
Returns the name of the record from the stream configuration. The record name may be null if was not determined before the exception occurred.

Returns:
the name of the record from the stream configuration

hasRecordErrors

boolean hasRecordErrors()
Returns true if there are one or more record level errors.

Returns:
true if there are one or more record level errors

getRecordErrors

Collection<String> getRecordErrors()
Returns the collection of record level error messages.

Returns:
the collection of record level error messages

getFieldText

String getFieldText(String fieldName)
Returns the unparsed text of a field from the record. Field text may be null under the following circumstances:

If the field is a collection, this method returns the field text for the first occurrence of the field.

Parameters:
fieldName - the name of the field to get the text for
Returns:
the unparsed field text

getFieldText

String getFieldText(String fieldName,
                    int index)
Returns the unparsed text of a field from the record. Field text may be null under the following circumstances:

Parameters:
fieldName - the name of the field to get the text for
index - the index of the field, beginning at 0, for collection type fields
Returns:
the unparsed field text

hasFieldErrors

boolean hasFieldErrors()
Returns true if there are one or more field level errors.

Returns:
true if there are one or more field level errors.

getFieldErrors

Map<String,Collection<String>> getFieldErrors()
Returns a Map of all field errors, where the Map key is the field name.

Returns:
a Map of all field errors

getFieldErrors

Collection<String> getFieldErrors(String fieldName)
Returns the field errors for a given field.

Parameters:
fieldName - the name of the field
Returns:
the collection of field errors for the named field

BeanIO 1.2.3

Copyright © 2010-2012 Kevin Seim