Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Copyright 2014-2015 the original author or authors.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *     http://www.apache.org/licenses/LICENSE-2.0
   *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
  * either express or implied. See the License for the specific language
  * governing permissions and limitations under the License.
  */
 package org.dbflute.helper.token.file;
 
 import java.util.List;
 import java.util.Map;
 

Author(s):
jflute
 
 public class FileTokenizingRowResource {
 
     // =====================================================================================
     //                                                                             Attribute
     //                                                                             =========
     protected List<String_valueList;
     protected String _rowString;
     protected int _rowNumber;
     protected int _lineNumber;
 
     // ===================================================================================
     //                                                                        Map Handling
     //                                                                        ============
     
Convert the value list to column value map.

Returns:
The map of column-key value. (NullAllowed: when no header or no value list)
 
     public Map<StringStringtoColumnValueMap() {
         if ( == null || .isEmpty()) {
             return null;
         }
         if ( == null || .isEmpty()) {
             return null;
         }
         final List<StringcolumnNameList = .getColumnNameList();
         if (columnNameList.size() != .size()) {
             String msg = "Different count between header columns and values:";
             msg = msg + " " + columnNameList.size() + ", " + .size();
             throw new FileTokenizingInvalidValueCountException(msg);
         }
         final Map<StringStringmap = new LinkedHashMap<StringString>(columnNameList.size());
         for (int i = 0; i < columnNameList.size(); i++) {
             final String columnName = columnNameList.get(i);
             final String value = .get(i);
             map.put(columnNamevalue);
         }
         return map;
     }
 
     // ===================================================================================
     //                                                                      Basic Override
     //                                                                      ==============
     @Override
     public String toString() {
         return "{" +  + ", row=" +  + ": " +  + "}";
     }
 
     // =====================================================================================
     //                                                                              Accessor
     //                                                                              ========
     
Get the header info of the token file.

Returns:
The header info of the token file. (NotNull in callback)
 
         return ;
     }
 
     public void setHeaderInfo(FileTokenizingHeaderInfo headerInfo) {
          = headerInfo;
     }

    
Get the list of value.
The list instance is recycled for next line, so you cannot save it (or convert it to your object).

Returns:
The list of value. (NotNull, NotEmpty in callback)
 
     public List<StringgetValueList() {
         return ;
     }
 
    public void setValueList(List<StringvalueList) {
         = valueList;
    }

    
Get the row string with delimiters. e.g. foo,bar,qux

Returns:
The string of row. (NotNull in callback)
    public String getRowString() {
        return ;
    }
    public void setRowString(String rowString) {
         = rowString;
    }

    
Get the row number. e.g. first data is always 1

Returns:
The integer as row number. (NotZero, NotMinus in callback)
    public int getRowNumber() {
        return ;
    }
    public void setRowNumber(int rowNumber) {
         = rowNumber;
    }

    
Get the line number. e.g. first data is 1 if no header, 2 if header exists

Returns:
The integer as line number. (NotZero, NotMinus in callback)
    public int getLineNumber() {
        return ;
    }
    public void setLineNumber(int lineNumber) {
         = lineNumber;
    }
New to GrepCode? Check out our FAQ X