Package au.com.bytecode.opencsv.bean

Examples of au.com.bytecode.opencsv.bean.CsvToBean


        ColumnPositionMappingStrategy mappingStrategy = new ColumnPositionMappingStrategy();
        mappingStrategy.setType(MyBean.class);
        String[] columns = new String[]{"name", "value", "amount1", "currency", "comments"}; // the fields to bind to in your JavaBean
        mappingStrategy.setColumnMapping(columns);

        CsvToBean csv = new CsvToBean();
        CSVReader reader = new CSVReader(new FileReader(filePath), CSVParser.DEFAULT_SEPARATOR, CSVParser.DEFAULT_QUOTE_CHARACTER, CSVParser.DEFAULT_ESCAPE_CHARACTER, 0, false, false);
        List<MyBean> list = csv.parse(mappingStrategy, reader);

        if (list.size() != 3) {
            System.out.println("Error - list size is wrong.");
        }
        MyBean myBean = list.get(2);
View Full Code Here

TOP

Related Classes of au.com.bytecode.opencsv.bean.CsvToBean

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.