org.dbflute.helper.token.file.FileMakingRowWriter Maven / Gradle / Ivy
/*
* Copyright 2014-2020 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.io.IOException;
import java.util.List;
import java.util.Map;
/**
* The writer of row for file making.
*
* File tsvFile = ... // output file
* List<String> columnNameList = ... // columns for header
* FileToken fileToken = new FileToken();
* fileToken.make(new FileOutputStream(tsvFile), writer -> {
* for (Member member : ...) { // output data loop
* List<String> valueList = ...; // convert the member to the row resource
* writer.writeRow(valueList); // Yes, you write!
* }
* }, op -> op.delimitateByTab().encodeAsUTF8().headerInfo(columnNameList));
*
* @author jflute
*/
public interface FileMakingRowWriter {
/**
* Write the row as value list to token file.
* Not Collection type because order is important here.
* @param valueList The list of value for row. (NotNull, NotEmpty)
* @throws IOException When the file writing failed.
*/
void writeRow(List valueList) throws IOException;
/**
* Write the row as column-key value map to token file.
* Unordered map is allowed by key-mapping. (according to header's column order)
* @param columnValueMap The map of column-key value for row. (NotNull, NotEmpty)
* @throws IOException When the file writing failed.
*/
void writeRow(Map columnValueMap) throws IOException;
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy