T - マッピング対象のBeanのクラスタイプpublic abstract class AbstractCsvAnnotationBeanWriter<T> extends AbstractCsvWriter
CsvBeanWriter| 修飾子とタイプ | フィールドと説明 |
|---|---|
protected BeanMappingCache<T> |
beanMappingCache
Beanのマッピング情報のキャッシュ。
|
protected List<Object> |
beanValues
temporary storage of bean values
|
protected MethodCache |
cache
cache of methods for mapping from fields to columns
|
protected List<String> |
errorMessages
processing error messages.
|
protected CsvExceptionConverter |
exceptionConverter
exception converter.
|
protected List<Object> |
processedColumns
temporary storage of processed columns to be written
|
protected List<CsvValidator<T>> |
validators
validator
|
| コンストラクタと説明 |
|---|
AbstractCsvAnnotationBeanWriter(Writer writer,
CsvPreference preference) |
| 修飾子とタイプ | メソッドと説明 |
|---|---|
void |
addValidator(CsvValidator<T>... validators)
レコード用の値を検証するValidatorを追加します。
|
protected void |
executeCellProcessors(List<Object> destination,
List<?> source,
CellProcessor[] processors,
CsvContext context)
行の各カラムの値に対して、CellProcessorを適用します。
|
protected Object |
executeNonCellProcessor(Object value,
CsvContext context)
CellProcessorを持たないカラムの値を処理します。
|
protected void |
extractBeanValues(Object source,
String[] nameMapping)
Extracts the bean values, using the supplied name mapping array.
|
BeanMapping<T> |
getBeanMapping()
Beanのマッピング情報を取得します。
|
String[] |
getDefinedHeader()
Beanクラスを元に作成したヘッダー情報を取得する。
|
List<String> |
getErrorMessages()
エラーメッセージを取得します。
|
CsvExceptionConverter |
getExceptionConverter()
処理中に発生した例外をメッセージに変換するクラスを取得します。
|
List<CsvValidator<T>> |
getValidators()
レコードの値を検証するValidatorを取得します。
|
protected void |
processErrors(CsvBindingErrors bindingErrors,
CsvContext context,
Optional<SuperCsvRowException> rowException)
行の例外情報をメッセージに変換したりします。
|
void |
setExceptionConverter(CsvExceptionConverter exceptionConverter)
処理中に発生した例外をメッセージに変換するクラスを設定します。
|
void |
write(T source)
レコードを書き込みます。
|
CsvWriteStatus |
write(T source,
CsvErrorHandler errorHandler)
例外発生時の処理を指定して、1レコード分を書き込みます。
|
close, flush, getLineNumber, getRowNumber, incrementRowAndLineNo, writeComment, writeHeader, writeRow, writeRow, writeRowprotected BeanMappingCache<T> beanMappingCache
protected final List<Object> processedColumns
protected final MethodCache cache
protected CsvExceptionConverter exceptionConverter
protected final List<CsvValidator<T>> validators
public AbstractCsvAnnotationBeanWriter(Writer writer, CsvPreference preference)
public void write(T source) throws IOException
source - 書き込むレコード。NullPointerException - source is null.IOException - レコードの出力に失敗した場合。SuperCsvException - レコードの値に問題がある場合public CsvWriteStatus write(T source, CsvErrorHandler errorHandler) throws IOException
source - 書き込むレコードのデータ。errorHandler - CSVに関する例外発生時の処理の実装。IOExceptionprotected void processErrors(CsvBindingErrors bindingErrors, CsvContext context, Optional<SuperCsvRowException> rowException)
bindingErrors - context - rowException - protected void extractBeanValues(Object source, String[] nameMapping) throws SuperCsvReflectionException
source - the beannameMapping - the name mappingNullPointerException - if source or nameMapping are nullSuperCsvReflectionException - if there was a reflection exception extracting the bean valueprotected void executeCellProcessors(List<Object> destination, List<?> source, CellProcessor[] processors, CsvContext context)
destination - CellProcessorで処理した結果のカラムの値。source - CellProcessで処理前のカラムの値。processors - 適用するCellProcesor。context - CSVカラム。protected Object executeNonCellProcessor(Object value, CsvContext context)
value - 処理前のカラムの値。context - CSV情報。public String[] getDefinedHeader()
ただし、列番号を省略され、定義がされていないカラムは、column[カラム番号]の形式となります。
public BeanMapping<T> getBeanMapping()
public CsvExceptionConverter getExceptionConverter()
public void setExceptionConverter(CsvExceptionConverter exceptionConverter)
exceptionConverter - 独自にカスタマイズした値を設定します。public void addValidator(CsvValidator<T>... validators)
validators - CsvValidatorの実装クラスを設定します。public List<CsvValidator<T>> getValidators()
CsvValidatorの実装クラスを設定します。Copyright © 2025 mygreen. All rights reserved.