Top Description Methods
com.univocity.parsers.annotations

public @Interface Format

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

Indicates that a parsed value is formatted and must be parsed before being assigned.

The Conversion type assigned to this field will depend on its type.

Multiple format masks can be tried for a single value.

When reading from this value (for writing to a given output), the first mask declared in Format#formats() will be used to produce its String representation.

The options() is an optional configuration, with properties and values separated by =.. Each property will be used configure the underlying formatter. For example, if the parsed value is a BigDecimal, and the format is '#0,00', the decimal separator must be set to ','. To specify this using the options() annotation, use:

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 String[]

Returns:

the sequence of formats to use.
formats
()

Formats that define how a value can be formatted.

public String[]

Returns:

a sequence of properties available in the underlying formatter and their respective values
options
()

Defines a sequence of properties and their values, used to configure the underlying formatter.

Inherited from java.lang.annotation.Annotation:
annotationTypeequalshashCodetoString

Method Detail

formatsback to summary
public String[] formats()

Formats that define how a value can be formatted. When reading, the values parsed from the input will be parsed according to the specified format. If multiple formats are defined, the first successful parsed value will be used. When writing, the first format defined in the sequence of formats will be used to produce the correct String representation.

Returns:String[]

the sequence of formats to use.

optionsback to summary
public String[] options()

Defines a sequence of properties and their values, used to configure the underlying formatter. Each element must be specified as property_name=property_value, e.g. options={"decimalSeparator=,", "maximumFractionDigits=3", "locale=en"}

Returns:String[]

a sequence of properties available in the underlying formatter and their respective values