public class ErrorContext extends Object implements RecordContext, Cloneable
| Constructor and Description | 
|---|
ErrorContext()
Constructs a new ErrorContext. 
 | 
| Modifier and Type | Method and Description | 
|---|---|
void | 
addFieldError(String fieldName,
             String message)
Adds a field error message. 
 | 
void | 
addRecordError(String message)
Adds a record level error message. 
 | 
void | 
clear()
Clears this context; 
 | 
int | 
getFieldCount(String fieldName)
Returns the number of times the given field was present in the stream. 
 | 
Map<String,Collection<String>> | 
getFieldErrors()
Returns a  
Map of all field errors. | 
Collection<String> | 
getFieldErrors(String fieldName)
Returns the field errors for a given field. 
 | 
String | 
getFieldText(String fieldName)
Returns the raw text of a field found in this record. 
 | 
String | 
getFieldText(String fieldName,
            int index)
Returns the raw text of a field found in this record. 
 | 
int | 
getLineNumber()
Returns the line number of this record, or 0 if the stream does not use
 new lines to terminate records. 
 | 
Collection<String> | 
getRecordErrors()
Returns a collection of record level error messages. 
 | 
int | 
getRecordLineNumber()
Returns the starting line number of the last record read from the record reader. 
 | 
String | 
getRecordName()
Returns the name of the last record read from the record reader, 
 or null if not known. 
 | 
String | 
getRecordText()
Returns the raw text of the last record read from the record reader. 
 | 
boolean | 
hasErrors()
Returns whether this record has any record or field level errors. 
 | 
boolean | 
hasFieldErrors()
Returns whether there are one or more field level errors. 
 | 
boolean | 
hasRecordErrors()
Returns whether there are one or more record level errors. 
 | 
void | 
setFieldText(String fieldName,
            String text,
            boolean repeating)
Sets the raw field text for a named field. 
 | 
void | 
setLineNumber(int lineNumber)
Sets the starting line number of the last record read from the record reader. 
 | 
void | 
setRecordName(String recordName)
Sets the name of the last record read from the record reader. 
 | 
void | 
setRecordText(String text)
Sets the raw text of the last record read from the record reader. 
 | 
public void clear()
public String getRecordText()
getRecordText in interface RecordContextpublic void setRecordText(String text)
text - the raw text of the last record readpublic int getRecordLineNumber()
getRecordLineNumber in interface RecordContextpublic void setLineNumber(int lineNumber)
lineNumber - the line number of the last recordpublic String getRecordName()
getRecordName in interface RecordContextpublic void setRecordName(String recordName)
recordName - the record namepublic void addFieldError(String fieldName, String message)
fieldName - the name of the fieldmessage - the error message to addpublic void addRecordError(String message)
message - the error message to addpublic void setFieldText(String fieldName, String text, boolean repeating)
fieldName - the name of the fieldtext - the raw field textrepeating - whether the field repeats in the streampublic boolean hasErrors()
RecordContexthasErrors in interface RecordContextpublic boolean hasRecordErrors()
RecordContexthasRecordErrors in interface RecordContextpublic Collection<String> getRecordErrors()
RecordContextgetRecordErrors in interface RecordContextCollection of record level error messagespublic int getFieldCount(String fieldName)
RecordContextgetFieldCount in interface RecordContextfieldName - the name of the fieldpublic String getFieldText(String fieldName)
RecordContextIf the field repeats in the stream, this method returns the field text for the first occurrence of the field.
getFieldText in interface RecordContextfieldName - the name of the fieldpublic String getFieldText(String fieldName, int index)
RecordContextgetFieldText in interface RecordContextfieldName - the name of the field to get the text forindex - the index of the field (beginning at 0), for repeating fieldspublic boolean hasFieldErrors()
RecordContexthasFieldErrors in interface RecordContextpublic Map<String,Collection<String>> getFieldErrors()
RecordContextMap of all field errors.  The name of the field is used for the
 Map key, and the value is a Collection of field error messages.getFieldErrors in interface RecordContextMap of all field errorspublic Collection<String> getFieldErrors(String fieldName)
RecordContextgetFieldErrors in interface RecordContextfieldName - the name of the fieldCollection of field errors, or null if no errors were
   reported for the fieldpublic int getLineNumber()
RecordContextgetLineNumber in interface RecordContext