com.univocity.parsers.annotations
Annotation Type Parsed


@Retention(value=RUNTIME)
@Inherited
@Target(value={FIELD,METHOD})
public @interface Parsed

Indicates the field is parsed. If the annotated field type is not a String, it will be automatically converted using one of the existing Conversion implementations in package com.univocity.parsers.conversions.

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

Implementation note: All annotations in @Parsed fields are processed by AnnotationHelper

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

Optional Element Summary
 boolean applyDefaultConversion
          Flag to indicate whether the parsed field should be converted automatically based on the field type.
 String defaultNullRead
          The default value to assign to this field in the parsed value is null
 String defaultNullWrite
          The default value to read from this field if it is null.
 String field
          The field name in a parsed record
 int index
          Field position in a parsed record
 

field

public abstract String field
The field name in a parsed record

Returns:
the field name (optional if the index is provided)
Default:
""

index

public abstract int index
Field position in a parsed record

Returns:
the position of this field (optional if the field name is provided)
Default:
-1

defaultNullRead

public abstract String defaultNullRead
The default value to assign to this field in the parsed value is null

The String literal "null" will be interpreted as a regular null.

Use "'null"' if you want the default value to be the string "null"

this value will have different effects depending on the field type:

Returns:
the default String to return when the parsed value is null
Default:
"null"

defaultNullWrite

public abstract String defaultNullWrite
The default value to read from this field if it is null. Used for writing to an output by BeanWriterProcessor.

The String literal "null" will be interpreted as a regular null.

Use "'null"' if you want the default value to be the string "null"

Returns:
default String to write when the input is null.
Default:
"null"

applyDefaultConversion

public abstract boolean applyDefaultConversion
Flag to indicate whether the parsed field should be converted automatically based on the field type. For example, if the annotated field is a BigDecimal, then BigDecimalConversion will be used to convert Strings to BigDecimal when reading and BigDecimal to String when writing. You may want to disable the default field conversion when using custom conversions through ConversionProcessor.convertFields(Conversion...),ConversionProcessor.convertIndexes(Conversion...) or ConversionProcessor.convertAll(Conversion...).

Returns:
flag indicating whether the default conversion, based on the field type, is to be applied for this field.
Default:
true


Copyright © 2015 uniVocity Software Pty Ltd. All rights reserved.