public class DefaultErrorRecord extends Object implements ErrorRecord
| Constructor and Description |
|---|
DefaultErrorRecord(Object source,
URI resource,
long position,
Throwable error)
Creates a new error record.
|
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
Clear all fields in this record.
|
Set<Field> |
fields()
Returns a set containing all the fields in this record.
|
Throwable |
getError()
Returns the error that prevented this record from being processed.
|
Object |
getFieldValue(Field field)
Returns the value associated with the given field.
|
long |
getPosition()
Returns the record's position inside its resource, typically the
line number if the resource is a file, or the row number, if the resource is a database table.
|
URI |
getResource()
Returns the record's resource location, typically the file or database table where it was
extracted from.
|
Object |
getSource()
Returns the record source, typically a line in a file or a row in a database table.
|
Collection<Object> |
values()
Returns a collection containing all the values in this record.
|
public DefaultErrorRecord(@Nullable
Object source,
@NonNull
URI resource,
long position,
@NonNull
Throwable error)
source - the record's source; may be null if the source cannot be determined or should not
be retained.resource - the record's resource.position - the record's position.error - the error.@Nullable public Object getSource()
Record@NonNull public URI getResource()
RecordDetails about the returned URI, and in particular its scheme, are implementation-specific.
getResource in interface Recordpublic long getPosition()
RecordNote that in the case of a file, the record's position is not necessarily equal to the line number where it appears. First, if there is one or more header lines, the actual line number would be its position + the number of header lines. Moreover, it the resource contains multi-line records, then it is not possible to draw a direct relationship between the record's position and its line.
Positions should be 1-based, i.e., the first record in the resource has position 1, and so on. If the position cannot be determined, this method should return -1.
getPosition in interface Record@NonNull public Set<Field> fields()
Record@NonNull public Collection<Object> values()
RecordThe iteration order of this collection should match that of Record.fields().
public Object getFieldValue(@NonNull Field field)
RecordNote that a return value of null may indicate that the record contains no such
field, or that the field value was null.
getFieldValue in interface Recordfield - the field.public void clear()
RecordThis method should be used to free memory, when this record's fields have been successfully processed and are no longer required.
@NonNull public Throwable getError()
ErrorRecordgetError in interface ErrorRecordCopyright © 2017–2021 DataStax. All rights reserved.