Top Description Methods
com.univocity.parsers.annotations

public @Interface Validate

extends Annotation
Annotations
@Retention:RUNTIME
@Inherited
@Target:FIELD, METHOD, ANNOTATION_TYPE
Imports
com.univocity.parsers.common.processor.*, com.univocity.parsers.conversions.*, java.lang.annotation.*

Performs basic validations against the String representation of the value found in the annotated field. A validation failure will generate a com.univocity.parsers.common.DataValidationException. By default, nulls and blanks are not allowed.

Commonly used for java beans processed using BeanProcessor and/or BeanWriterProcessor

Author
Univocity Software Pty Ltd - [email protected]
See Also
Conversion, Conversions, BeanProcessor, BeanWriterProcessor

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

true true if blanks are allowed, false otherwise
allowBlanks
()

Indicates whether this field can be blank (i.e. contain 0 or more whitespaces, where a whitespace is any character <= ' '

public String

Returns:

the regular expression that determines an expected format for the given value
matches
()

Ensures that the value of this field matches a given regular expression.

public String[]

Returns:

the sequence of disallowed values
noneOf
()

Ensures that the value of this field does is not an unwanted value.

public boolean

Returns:

true true if nulls are allowed, false otherwise
nullable
()

Indicates whether this field can be null

public String[]

Returns:

the sequence of allowed values
oneOf
()

Ensures that the value of this field is one of a given set of alternatives

public Class<? extends Validator<T>>[]

Returns:

custom classes to be used to validate any value associated with this field.
validators
()

User provided implementations of Validator which will be executed in sequence after the validations specified in this annotation execute.

Inherited from java.lang.annotation.Annotation:
annotationTypeequalshashCodetoString

Method Detail

allowBlanksback to summary
public boolean allowBlanks()

Indicates whether this field can be blank (i.e. contain 0 or more whitespaces, where a whitespace is any character <= ' '

Returns:boolean

true true if blanks are allowed, false otherwise

matchesback to summary
public String matches()

Ensures that the value of this field matches a given regular expression.

Returns:String

the regular expression that determines an expected format for the given value

noneOfback to summary
public String[] noneOf()

Ensures that the value of this field does is not an unwanted value.

Returns:String[]

the sequence of disallowed values

nullableback to summary
public boolean nullable()

Indicates whether this field can be null

Returns:boolean

true true if nulls are allowed, false otherwise

oneOfback to summary
public String[] oneOf()

Ensures that the value of this field is one of a given set of alternatives

Returns:String[]

the sequence of allowed values

validatorsback to summary
public Class<? extends Validator<T>>[] validators()

User provided implementations of Validator which will be executed in sequence after the validations specified in this annotation execute.

Returns:Class<? extends Validator<T>>[]

custom classes to be used to validate any value associated with this field.