Top Description Methods
com.opencsv.validators

public Interface LineValidator

Imports
com.opencsv.exceptions.CsvValidationException

This is the interface for validators for a String read by the java.io.Reader in the com.opencsv.CSVReader before it is processed.

This should only be used if you have a very good understanding and full control of the data being processed.

Since this is working on an individual line it may not be a full record if an element has a newline character in it.

Author
Scott Conway
Since
5.0

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

true if the line is valid, false otherwise
isValid
(String
String to be validated
line
)

Performs the validation check on the string and returns the result.

public void
validate(String
String to be validated
line
)

Performs the validation check on the string and throws an exception if invalid.

Method Detail

isValidback to summary
public boolean isValid(String line)

Performs the validation check on the string and returns the result. While not called directly in opencsv it is in the interface to provide an easy way to test if the validator is function properly.

Parameters
line:String

String to be validated

Returns:boolean

true if the line is valid, false otherwise

validateback to summary
public void validate(String line) throws CsvValidationException

Performs the validation check on the string and throws an exception if invalid.

Parameters
line:String

String to be validated

Exceptions
CsvValidationException:
Thrown if invalid. Should contain a message describing the error.