All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.supercsv.ext.builder.CsvBeanMapping Maven / Gradle / Ivy

Go to download

CSVのJavaライブラリであるSuperCSVに、アノテーション機能を追加したライブラリです。

There is a newer version: 2.3
Show newest version
/*
 * CsvBeanMapping.java
 * created in 2013/03/05
 *
 * (C) Copyright 2003-2013 GreenDay Project. All rights reserved.
 */
package org.supercsv.ext.builder;

import java.util.ArrayList;
import java.util.List;

import org.supercsv.cellprocessor.ift.CellProcessor;


/**
 *
 *
 * @author T.TSUCHIE
 *
 */
public class CsvBeanMapping {
    
    private final Class type;
    
    public CsvBeanMapping(final Class type) {
        this.type = type;
    }
    
    private boolean header;
    
    private List columns;
    
    public String[] getHeader() {
        
        List list = new ArrayList();
        for(CsvColumnMapping column : columns) {
            list.add(column.getLabel());
        }
        return list.toArray(new String[0]);
    }
    
    public String[] getNameMapping() {
        
        List list = new ArrayList();
        for(CsvColumnMapping column : columns) {
            list.add(column.getColumnName());
        }
        return list.toArray(new String[0]);
    }
    
    public CellProcessor[] getInputCellProcessor() {
        
        List list = new ArrayList();
        for(CsvColumnMapping column : columns) {
            list.add(column.getInputCellProcessor());
        }
        return list.toArray(new CellProcessor[0]);
    }
    
    public CellProcessor[] getOutputCellProcessor() {
        
        List list = new ArrayList();
        for(CsvColumnMapping column : columns) {
            list.add(column.getOutputCellProcessor());
        }
        return list.toArray(new CellProcessor[0]);
    }
    
    public Class getType() {
        return type;
    }
    
    public boolean isHeader() {
        return header;
    }
    
    public void setHeader(final boolean header) {
        this.header = header;
    }
    
    public List getColumns() {
        return columns;
    }
    
    public void setColumns(final List columns) {
        this.columns = columns;
    }
    
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy