Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* FINBOURNE Luminesce Web API
*
* Contact: [email protected]
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package com.finbourne.luminesce.model;
import java.util.Objects;
import com.google.gson.TypeAdapter;
import com.google.gson.annotations.JsonAdapter;
import com.google.gson.annotations.SerializedName;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
import java.io.IOException;
import java.util.Arrays;
import org.openapitools.jackson.nullable.JsonNullable;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonArray;
import com.google.gson.JsonDeserializationContext;
import com.google.gson.JsonDeserializer;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonParseException;
import com.google.gson.TypeAdapterFactory;
import com.google.gson.reflect.TypeToken;
import com.google.gson.TypeAdapter;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
import java.io.IOException;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import com.finbourne.luminesce.JSON;
/**
* Additional options applicable to the given SourceType
*/
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class OptionsExcel {
public static final String SERIALIZED_NAME_COLUMN_NAMES = "columnNames";
@SerializedName(SERIALIZED_NAME_COLUMN_NAMES)
private String columnNames;
public static final String SERIALIZED_NAME_COLUMN_TYPES = "columnTypes";
@SerializedName(SERIALIZED_NAME_COLUMN_TYPES)
private String columnTypes;
public static final String SERIALIZED_NAME_INFER_TYPE_ROW_COUNT = "inferTypeRowCount";
@SerializedName(SERIALIZED_NAME_INFER_TYPE_ROW_COUNT)
private Integer inferTypeRowCount;
public static final String SERIALIZED_NAME_NO_HEADER = "noHeader";
@SerializedName(SERIALIZED_NAME_NO_HEADER)
private Boolean noHeader;
public static final String SERIALIZED_NAME_CALCULATE = "calculate";
@SerializedName(SERIALIZED_NAME_CALCULATE)
private Boolean calculate;
public static final String SERIALIZED_NAME_PASSWORD = "password";
@SerializedName(SERIALIZED_NAME_PASSWORD)
private String password;
public static final String SERIALIZED_NAME_WORKSHEET = "worksheet";
@SerializedName(SERIALIZED_NAME_WORKSHEET)
private String worksheet;
public static final String SERIALIZED_NAME_RANGE_OR_TABLE = "rangeOrTable";
@SerializedName(SERIALIZED_NAME_RANGE_OR_TABLE)
private String rangeOrTable;
public static final String SERIALIZED_NAME_IGNORE_INVALID_CELLS = "ignoreInvalidCells";
@SerializedName(SERIALIZED_NAME_IGNORE_INVALID_CELLS)
private Boolean ignoreInvalidCells;
public static final String SERIALIZED_NAME_IGNORE_BLANK_ROWS = "ignoreBlankRows";
@SerializedName(SERIALIZED_NAME_IGNORE_BLANK_ROWS)
private Boolean ignoreBlankRows;
public OptionsExcel() {
}
public OptionsExcel columnNames(String columnNames) {
this.columnNames = columnNames;
return this;
}
/**
* Column Names either overrides the header row or steps in when there is no header row (comma delimited list)
* @return columnNames
**/
@jakarta.annotation.Nullable
public String getColumnNames() {
return columnNames;
}
public void setColumnNames(String columnNames) {
this.columnNames = columnNames;
}
public OptionsExcel columnTypes(String columnTypes) {
this.columnTypes = columnTypes;
return this;
}
/**
* Column types (comma delimited list of: '{types}', some columns may be left blank while others are specified)
* @return columnTypes
**/
@jakarta.annotation.Nullable
public String getColumnTypes() {
return columnTypes;
}
public void setColumnTypes(String columnTypes) {
this.columnTypes = columnTypes;
}
public OptionsExcel inferTypeRowCount(Integer inferTypeRowCount) {
this.inferTypeRowCount = inferTypeRowCount;
return this;
}
/**
* If non-zero and 'types' is not specified (or not specified for some columns) this will look through N rows to attempt to work out the column types for columns not pre-specified
* @return inferTypeRowCount
**/
@jakarta.annotation.Nullable
public Integer getInferTypeRowCount() {
return inferTypeRowCount;
}
public void setInferTypeRowCount(Integer inferTypeRowCount) {
this.inferTypeRowCount = inferTypeRowCount;
}
public OptionsExcel noHeader(Boolean noHeader) {
this.noHeader = noHeader;
return this;
}
/**
* Set this if there is no header row
* @return noHeader
**/
@jakarta.annotation.Nullable
public Boolean getNoHeader() {
return noHeader;
}
public void setNoHeader(Boolean noHeader) {
this.noHeader = noHeader;
}
public OptionsExcel calculate(Boolean calculate) {
this.calculate = calculate;
return this;
}
/**
* Whether to attempt a calculation of the imported cell range prior to import
* @return calculate
**/
@jakarta.annotation.Nullable
public Boolean getCalculate() {
return calculate;
}
public void setCalculate(Boolean calculate) {
this.calculate = calculate;
}
public OptionsExcel password(String password) {
this.password = password;
return this;
}
/**
* If specified will be used as the password used for password protected workbooks
* @return password
**/
@jakarta.annotation.Nullable
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public OptionsExcel worksheet(String worksheet) {
this.worksheet = worksheet;
return this;
}
/**
* The worksheet containing the cell range to import (name or index, will default to first)
* @return worksheet
**/
@jakarta.annotation.Nullable
public String getWorksheet() {
return worksheet;
}
public void setWorksheet(String worksheet) {
this.worksheet = worksheet;
}
public OptionsExcel rangeOrTable(String rangeOrTable) {
this.rangeOrTable = rangeOrTable;
return this;
}
/**
* The cell range to import as either a specified range or a table name
* @return rangeOrTable
**/
@jakarta.annotation.Nullable
public String getRangeOrTable() {
return rangeOrTable;
}
public void setRangeOrTable(String rangeOrTable) {
this.rangeOrTable = rangeOrTable;
}
public OptionsExcel ignoreInvalidCells(Boolean ignoreInvalidCells) {
this.ignoreInvalidCells = ignoreInvalidCells;
return this;
}
/**
* If specified cells which can not be successfully converted to the target type will be ignored
* @return ignoreInvalidCells
**/
@jakarta.annotation.Nullable
public Boolean getIgnoreInvalidCells() {
return ignoreInvalidCells;
}
public void setIgnoreInvalidCells(Boolean ignoreInvalidCells) {
this.ignoreInvalidCells = ignoreInvalidCells;
}
public OptionsExcel ignoreBlankRows(Boolean ignoreBlankRows) {
this.ignoreBlankRows = ignoreBlankRows;
return this;
}
/**
* If the entire rows has only blank cells it will be ignored will be ignored
* @return ignoreBlankRows
**/
@jakarta.annotation.Nullable
public Boolean getIgnoreBlankRows() {
return ignoreBlankRows;
}
public void setIgnoreBlankRows(Boolean ignoreBlankRows) {
this.ignoreBlankRows = ignoreBlankRows;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
OptionsExcel optionsExcel = (OptionsExcel) o;
return Objects.equals(this.columnNames, optionsExcel.columnNames) &&
Objects.equals(this.columnTypes, optionsExcel.columnTypes) &&
Objects.equals(this.inferTypeRowCount, optionsExcel.inferTypeRowCount) &&
Objects.equals(this.noHeader, optionsExcel.noHeader) &&
Objects.equals(this.calculate, optionsExcel.calculate) &&
Objects.equals(this.password, optionsExcel.password) &&
Objects.equals(this.worksheet, optionsExcel.worksheet) &&
Objects.equals(this.rangeOrTable, optionsExcel.rangeOrTable) &&
Objects.equals(this.ignoreInvalidCells, optionsExcel.ignoreInvalidCells) &&
Objects.equals(this.ignoreBlankRows, optionsExcel.ignoreBlankRows);
}
private static boolean equalsNullable(JsonNullable a, JsonNullable b) {
return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get()));
}
@Override
public int hashCode() {
return Objects.hash(columnNames, columnTypes, inferTypeRowCount, noHeader, calculate, password, worksheet, rangeOrTable, ignoreInvalidCells, ignoreBlankRows);
}
private static int hashCodeNullable(JsonNullable a) {
if (a == null) {
return 1;
}
return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class OptionsExcel {\n");
sb.append(" columnNames: ").append(toIndentedString(columnNames)).append("\n");
sb.append(" columnTypes: ").append(toIndentedString(columnTypes)).append("\n");
sb.append(" inferTypeRowCount: ").append(toIndentedString(inferTypeRowCount)).append("\n");
sb.append(" noHeader: ").append(toIndentedString(noHeader)).append("\n");
sb.append(" calculate: ").append(toIndentedString(calculate)).append("\n");
sb.append(" password: ").append(toIndentedString(password)).append("\n");
sb.append(" worksheet: ").append(toIndentedString(worksheet)).append("\n");
sb.append(" rangeOrTable: ").append(toIndentedString(rangeOrTable)).append("\n");
sb.append(" ignoreInvalidCells: ").append(toIndentedString(ignoreInvalidCells)).append("\n");
sb.append(" ignoreBlankRows: ").append(toIndentedString(ignoreBlankRows)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
public static HashSet openapiFields;
public static HashSet openapiRequiredFields;
static {
// a set of all properties/fields (JSON key names)
openapiFields = new HashSet();
openapiFields.add("columnNames");
openapiFields.add("columnTypes");
openapiFields.add("inferTypeRowCount");
openapiFields.add("noHeader");
openapiFields.add("calculate");
openapiFields.add("password");
openapiFields.add("worksheet");
openapiFields.add("rangeOrTable");
openapiFields.add("ignoreInvalidCells");
openapiFields.add("ignoreBlankRows");
// a set of required properties/fields (JSON key names)
openapiRequiredFields = new HashSet();
}
/**
* Validates the JSON Element and throws an exception if issues found
*
* @param jsonElement JSON Element
* @throws IOException if the JSON Element is invalid with respect to OptionsExcel
*/
public static void validateJsonElement(JsonElement jsonElement) throws IOException {
if (jsonElement == null) {
if (!OptionsExcel.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null
throw new IllegalArgumentException(String.format("The required field(s) %s in OptionsExcel is not found in the empty JSON string", OptionsExcel.openapiRequiredFields.toString()));
}
}
JsonObject jsonObj = jsonElement.getAsJsonObject();
if ((jsonObj.get("columnNames") != null && !jsonObj.get("columnNames").isJsonNull()) && !jsonObj.get("columnNames").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `columnNames` to be a primitive type in the JSON string but got `%s`", jsonObj.get("columnNames").toString()));
}
if ((jsonObj.get("columnTypes") != null && !jsonObj.get("columnTypes").isJsonNull()) && !jsonObj.get("columnTypes").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `columnTypes` to be a primitive type in the JSON string but got `%s`", jsonObj.get("columnTypes").toString()));
}
if ((jsonObj.get("password") != null && !jsonObj.get("password").isJsonNull()) && !jsonObj.get("password").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `password` to be a primitive type in the JSON string but got `%s`", jsonObj.get("password").toString()));
}
if ((jsonObj.get("worksheet") != null && !jsonObj.get("worksheet").isJsonNull()) && !jsonObj.get("worksheet").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `worksheet` to be a primitive type in the JSON string but got `%s`", jsonObj.get("worksheet").toString()));
}
if ((jsonObj.get("rangeOrTable") != null && !jsonObj.get("rangeOrTable").isJsonNull()) && !jsonObj.get("rangeOrTable").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `rangeOrTable` to be a primitive type in the JSON string but got `%s`", jsonObj.get("rangeOrTable").toString()));
}
}
public static class CustomTypeAdapterFactory implements TypeAdapterFactory {
@SuppressWarnings("unchecked")
@Override
public TypeAdapter create(Gson gson, TypeToken type) {
if (!OptionsExcel.class.isAssignableFrom(type.getRawType())) {
return null; // this class only serializes 'OptionsExcel' and its subtypes
}
final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class);
final TypeAdapter thisAdapter
= gson.getDelegateAdapter(this, TypeToken.get(OptionsExcel.class));
return (TypeAdapter) new TypeAdapter() {
@Override
public void write(JsonWriter out, OptionsExcel value) throws IOException {
JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject();
elementAdapter.write(out, obj);
}
@Override
public OptionsExcel read(JsonReader in) throws IOException {
JsonElement jsonElement = elementAdapter.read(in);
validateJsonElement(jsonElement);
return thisAdapter.fromJsonTree(jsonElement);
}
}.nullSafe();
}
}
/**
* Create an instance of OptionsExcel given an JSON string
*
* @param jsonString JSON string
* @return An instance of OptionsExcel
* @throws IOException if the JSON string is invalid with respect to OptionsExcel
*/
public static OptionsExcel fromJson(String jsonString) throws IOException {
return JSON.getGson().fromJson(jsonString, OptionsExcel.class);
}
/**
* Convert an instance of OptionsExcel to an JSON string
*
* @return JSON string
*/
public String toJson() {
return JSON.getGson().toJson(this);
}
}