@Documented @Retention(value=RUNTIME) @Target(value=FIELD) @Repeatable(value=CsvNumbers.class) public @interface CsvNumber
CsvBindByName
,
CsvBindByPosition
, etc.), it is used for the conversion. The
following types are supported:
Byte
Double
Float
Integer
Long
Short
BigDecimal
BigInteger
Modifier and Type | Required Element and Description |
---|---|
String |
value
A decimal format string.
|
Modifier and Type | Optional Element and Description |
---|---|
String[] |
profiles
A profile can be used to annotate the same field differently for
different inputs or outputs.
|
RoundingMode |
roundingMode
The rounding mode for formatting decimals.
|
String |
writeFormat
A number format string.
|
boolean |
writeFormatEqualsReadFormat
Whether or not the same format string is used for writing as for reading.
|
public abstract String value
DecimalFormat
. The locale is gleaned from one of the
other CSV-related annotations if present there, or failing that, is the
default locale for the JVM. If your code might run under different
locales, you are strongly encouraged to always specify a locale for
conversions, otherwise your code will behave unpredictably.public abstract boolean writeFormatEqualsReadFormat
value()
is used for both reading and writing
and writeFormat()
is ignored.public abstract String writeFormat
value()
,
writeFormatEqualsReadFormat()
public abstract String[] profiles
Perhaps you have multiple input sources, and they all use different header names or positions for the same data. With profiles, you don't have to create different beans with the same fields and different annotations for each input. Simply annotate the same field multiple times and specify the profile when you parse the input.
The same applies to output: if you want to be able to represent the same data in multiple CSV formats (that is, with different headers or orders), annotate the bean fields multiple times with different profiles and specify which profile you want to use on writing.
Results are undefined if profile names are not unique.
If the same configuration applies to multiple profiles, simply list all applicable profile names here. This parameter is an array of strings.
The empty string, which is the default value, specifies the default profile and will be used if no annotation for the specific profile being used can be found, or if no profile is specified.
public abstract RoundingMode roundingMode
DecimalFormat
's
default, is RoundingMode.HALF_EVEN
.Copyright © 2005–2023. All rights reserved.