Package au.com.bytecode.opencsv.bean

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


     * @param originalCommentText
     * @throws FileNotFoundException
     */
    protected void testMappingStrategyRead(String originalCommentText)
            throws FileNotFoundException {
        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);

View Full Code Here

TOP

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

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.