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

com.redis.riot.FileReaderArgs Maven / Gradle / Ivy

The newest version!
package com.redis.riot;

import java.util.List;
import java.util.Set;

import com.redis.riot.file.ReadOptions;

import lombok.ToString;
import picocli.CommandLine.Option;

@ToString
public class FileReaderArgs extends FileArgs {

	@Option(names = "--ranges", arity = "1..*", description = "Column ranges for fixed-length files.", paramLabel = "")
	private List columnRanges;

	@Option(names = "--cont", description = "Line continuation string (default: ${DEFAULT-VALUE}).", paramLabel = "")
	private String continuationString = ReadOptions.DEFAULT_CONTINUATION_STRING;

	@Option(names = "--fields", arity = "1..*", description = "Delimited/FW field names.", paramLabel = "")
	private List fields;

	@Option(names = "--header-line", description = "Index of header line.", paramLabel = "")
	private Integer headerLine;

	@Option(names = "--include", arity = "1..*", description = "Field indices to include in CSV/fixed-length files (0-based).", paramLabel = "")
	private Set includedFields;

	@Option(names = "--skip-lines", description = "Lines to skip at start of CSV/fixed-length files.", paramLabel = "")
	private Integer linesToSkip;

	@Option(names = "--max", description = "Max number of lines to import.", paramLabel = "")
	private int maxItemCount;

	public ReadOptions readOptions() {
		ReadOptions options = new ReadOptions();
		apply(options);
		options.setColumnRanges(columnRanges);
		options.setContinuationString(continuationString);
		options.setFields(fields);
		options.setHeaderLine(headerLine);
		options.setIncludedFields(includedFields);
		options.setLinesToSkip(linesToSkip);
		options.setMaxItemCount(maxItemCount);
		return options;
	}

	public List getColumnRanges() {
		return columnRanges;
	}

	public void setColumnRanges(List columnRanges) {
		this.columnRanges = columnRanges;
	}

	public String getContinuationString() {
		return continuationString;
	}

	public void setContinuationString(String continuationString) {
		this.continuationString = continuationString;
	}

	public List getFields() {
		return fields;
	}

	public void setFields(List fields) {
		this.fields = fields;
	}

	public Integer getHeaderLine() {
		return headerLine;
	}

	public void setHeaderLine(Integer headerLine) {
		this.headerLine = headerLine;
	}

	public Set getIncludedFields() {
		return includedFields;
	}

	public void setIncludedFields(Set fields) {
		this.includedFields = fields;
	}

	public Integer getLinesToSkip() {
		return linesToSkip;
	}

	public void setLinesToSkip(Integer linesToSkip) {
		this.linesToSkip = linesToSkip;
	}

	public int getMaxItemCount() {
		return maxItemCount;
	}

	public void setMaxItemCount(int maxItemCount) {
		this.maxItemCount = maxItemCount;
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy