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

com.redis.riot.file.FileWriterOptions Maven / Gradle / Ivy

There is a newer version: 4.1.3
Show newest version
package com.redis.riot.file;

import java.util.Map;
import java.util.function.Supplier;

import com.google.cloud.spring.core.GcpScope;

import lombok.ToString;

@ToString
public class FileWriterOptions {

	public static final String DEFAULT_LINE_SEPARATOR = System.getProperty("line.separator");
	public static final boolean DEFAULT_SHOULD_DELETE_IF_EXISTS = true;
	public static final boolean DEFAULT_TRANSACTIONAL = true;
	public static final String DEFAULT_ELEMENT_NAME = "record";
	public static final String DEFAULT_ROOT_NAME = "root";

	private FileOptions fileOptions = new FileOptions();
	private String formatterString;
	private boolean append;
	private boolean forceSync;
	private String lineSeparator = DEFAULT_LINE_SEPARATOR;
	private boolean shouldDeleteIfEmpty;
	private boolean shouldDeleteIfExists = DEFAULT_SHOULD_DELETE_IF_EXISTS;
	private boolean transactional = DEFAULT_TRANSACTIONAL;
	private String rootName = DEFAULT_ROOT_NAME;
	private String elementName = DEFAULT_ELEMENT_NAME;
	private Supplier> headerSupplier = () -> null;

	public FileOptions getFileOptions() {
		return fileOptions;
	}

	public void setFileOptions(FileOptions fileOptions) {
		this.fileOptions = fileOptions;
	}

	public Supplier> getHeaderSupplier() {
		return headerSupplier;
	}

	public void setHeaderSupplier(Supplier> headerSupplier) {
		this.headerSupplier = headerSupplier;
	}

	public String getRootName() {
		return rootName;
	}

	public void setRootName(String name) {
		this.rootName = name;
	}

	public String getElementName() {
		return elementName;
	}

	public void setElementName(String name) {
		this.elementName = name;
	}

	public FileWriterOptions() {
		fileOptions.getResourceOptions().getGcpOptions().setScope(GcpScope.STORAGE_READ_WRITE);
	}

	public boolean isAppend() {
		return append;
	}

	public void setAppend(boolean append) {
		this.append = append;
	}

	public boolean isForceSync() {
		return forceSync;
	}

	public void setForceSync(boolean forceSync) {
		this.forceSync = forceSync;
	}

	public String getLineSeparator() {
		return lineSeparator;
	}

	public void setLineSeparator(String separator) {
		this.lineSeparator = separator;
	}

	public boolean isShouldDeleteIfEmpty() {
		return shouldDeleteIfEmpty;
	}

	public void setShouldDeleteIfEmpty(boolean delete) {
		this.shouldDeleteIfEmpty = delete;
	}

	public boolean isShouldDeleteIfExists() {
		return shouldDeleteIfExists;
	}

	public void setShouldDeleteIfExists(boolean delete) {
		this.shouldDeleteIfExists = delete;
	}

	public String getFormatterString() {
		return formatterString;
	}

	public void setFormatterString(String formatterString) {
		this.formatterString = formatterString;
	}

	public boolean isTransactional() {
		return transactional;
	}

	public void setTransactional(boolean transactional) {
		this.transactional = transactional;
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy