com.github.mygreen.supercsv.io.BeanMappingCache Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of super-csv-annotation Show documentation
Show all versions of super-csv-annotation Show documentation
CSVのJavaライブラリであるSuperCSVに、アノテーション機能を追加したライブラリです。
package com.github.mygreen.supercsv.io;
import org.supercsv.cellprocessor.ift.CellProcessor;
import com.github.mygreen.supercsv.builder.BeanMapping;
/**
* Beanのマッピング情報のキャッシュ。
* レコードの実行ごとに、
*
* @version 2.0
* @author T.TSUCHIE
*
*/
public class BeanMappingCache {
private final BeanMapping beanMapping;
private String[] header;
private String[] nameMapping;
private CellProcessor[] cellProcessorsForReading;
private CellProcessor[] cellProcessorsForWriting;
private BeanMappingCache(final BeanMapping beanMapping) {
this.beanMapping = beanMapping;
}
public static BeanMappingCache create(final BeanMapping beanMapping) {
final BeanMappingCache cache = new BeanMappingCache<>(beanMapping);
cache.header = beanMapping.getHeader();
cache.nameMapping = beanMapping.getNameMapping();
cache.cellProcessorsForReading = beanMapping.getCellProcessorsForReading();
cache.cellProcessorsForWriting = beanMapping.getCellProcessorsForWriting();
return cache;
}
/**
* キャッシュ元のデータを取得する。
* @return キャッシュ元となったマッピング情報。
*/
public BeanMapping getOriginal() {
return beanMapping;
}
public String[] getHeader() {
return header;
}
public String[] getNameMapping() {
return nameMapping;
}
public CellProcessor[] getCellProcessorsForReading() {
return cellProcessorsForReading;
}
public CellProcessor[] getCellProcessorsForWriting() {
return cellProcessorsForWriting;
}
}