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

com.dominodatalab.pub.model.SchemaDefinitionItem Maven / Gradle / Ivy

Go to download

Domino Data Lab API Client to connect to Domino web services using Java HTTP Client.

There is a newer version: 6.0.1.0
Show newest version
/*
 * Domino Public API
 * Domino Public API Endpoints
 *
 * The version of the OpenAPI document: 0.0.0
 * 
 *
 * 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.dominodatalab.pub.model;

import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.StringJoiner;
import java.util.Objects;
import java.util.Map;
import java.util.HashMap;
import com.dominodatalab.pub.model.SchemaValueDataType;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;


import com.dominodatalab.pub.invoker.ApiClient;
/**
 * Property of a schema for a dynamic data type
 */
@JsonPropertyOrder({
  SchemaDefinitionItem.JSON_PROPERTY_DEFAULT,
  SchemaDefinitionItem.JSON_PROPERTY_DESCRIPTION,
  SchemaDefinitionItem.JSON_PROPERTY_GROUP,
  SchemaDefinitionItem.JSON_PROPERTY_LENGTH,
  SchemaDefinitionItem.JSON_PROPERTY_MAX,
  SchemaDefinitionItem.JSON_PROPERTY_MIN,
  SchemaDefinitionItem.JSON_PROPERTY_NAME,
  SchemaDefinitionItem.JSON_PROPERTY_OPTIONAL,
  SchemaDefinitionItem.JSON_PROPERTY_REGEX,
  SchemaDefinitionItem.JSON_PROPERTY_TITLE,
  SchemaDefinitionItem.JSON_PROPERTY_TYPE,
  SchemaDefinitionItem.JSON_PROPERTY_VALUES
})
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-10-04T16:37:28.765500600-04:00[America/New_York]", comments = "Generator version: 7.8.0")
public class SchemaDefinitionItem {
  public static final String JSON_PROPERTY_DEFAULT = "default";
  private String _default;

  public static final String JSON_PROPERTY_DESCRIPTION = "description";
  private String description;

  public static final String JSON_PROPERTY_GROUP = "group";
  private String group;

  public static final String JSON_PROPERTY_LENGTH = "length";
  private Integer length;

  public static final String JSON_PROPERTY_MAX = "max";
  private BigDecimal max;

  public static final String JSON_PROPERTY_MIN = "min";
  private BigDecimal min;

  public static final String JSON_PROPERTY_NAME = "name";
  private String name;

  public static final String JSON_PROPERTY_OPTIONAL = "optional";
  private Boolean optional = false;

  public static final String JSON_PROPERTY_REGEX = "regex";
  private String regex;

  public static final String JSON_PROPERTY_TITLE = "title";
  private String title;

  public static final String JSON_PROPERTY_TYPE = "type";
  private SchemaValueDataType type;

  public static final String JSON_PROPERTY_VALUES = "values";
  private List values = new ArrayList<>();

  public SchemaDefinitionItem() { 
  }

  public SchemaDefinitionItem _default(String _default) {
    this._default = _default;
    return this;
  }

  /**
   * Get _default
   * @return _default
   */
  @javax.annotation.Nullable
  @JsonProperty(JSON_PROPERTY_DEFAULT)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public String getDefault() {
    return _default;
  }


  @JsonProperty(JSON_PROPERTY_DEFAULT)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setDefault(String _default) {
    this._default = _default;
  }


  public SchemaDefinitionItem description(String description) {
    this.description = description;
    return this;
  }

  /**
   * Description for the property
   * @return description
   */
  @javax.annotation.Nullable
  @JsonProperty(JSON_PROPERTY_DESCRIPTION)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public String getDescription() {
    return description;
  }


  @JsonProperty(JSON_PROPERTY_DESCRIPTION)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setDescription(String description) {
    this.description = description;
  }


  public SchemaDefinitionItem group(String group) {
    this.group = group;
    return this;
  }

  /**
   * Name of group where other fields of the same group will be displayed
   * @return group
   */
  @javax.annotation.Nullable
  @JsonProperty(JSON_PROPERTY_GROUP)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public String getGroup() {
    return group;
  }


  @JsonProperty(JSON_PROPERTY_GROUP)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setGroup(String group) {
    this.group = group;
  }


  public SchemaDefinitionItem length(Integer length) {
    this.length = length;
    return this;
  }

  /**
   * Maximum length (for text & secret fields)
   * @return length
   */
  @javax.annotation.Nullable
  @JsonProperty(JSON_PROPERTY_LENGTH)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public Integer getLength() {
    return length;
  }


  @JsonProperty(JSON_PROPERTY_LENGTH)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setLength(Integer length) {
    this.length = length;
  }


  public SchemaDefinitionItem max(BigDecimal max) {
    this.max = max;
    return this;
  }

  /**
   * Maximum value (for numeric fields)
   * @return max
   */
  @javax.annotation.Nullable
  @JsonProperty(JSON_PROPERTY_MAX)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public BigDecimal getMax() {
    return max;
  }


  @JsonProperty(JSON_PROPERTY_MAX)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setMax(BigDecimal max) {
    this.max = max;
  }


  public SchemaDefinitionItem min(BigDecimal min) {
    this.min = min;
    return this;
  }

  /**
   * Minimum value (for numeric fields)
   * @return min
   */
  @javax.annotation.Nullable
  @JsonProperty(JSON_PROPERTY_MIN)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public BigDecimal getMin() {
    return min;
  }


  @JsonProperty(JSON_PROPERTY_MIN)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setMin(BigDecimal min) {
    this.min = min;
  }


  public SchemaDefinitionItem name(String name) {
    this.name = name;
    return this;
  }

  /**
   * Internal name of the property
   * @return name
   */
  @javax.annotation.Nonnull
  @JsonProperty(JSON_PROPERTY_NAME)
  @JsonInclude(value = JsonInclude.Include.ALWAYS)
  public String getName() {
    return name;
  }


  @JsonProperty(JSON_PROPERTY_NAME)
  @JsonInclude(value = JsonInclude.Include.ALWAYS)
  public void setName(String name) {
    this.name = name;
  }


  public SchemaDefinitionItem optional(Boolean optional) {
    this.optional = optional;
    return this;
  }

  /**
   * Whether or not the field is optional, defaults to false
   * @return optional
   */
  @javax.annotation.Nullable
  @JsonProperty(JSON_PROPERTY_OPTIONAL)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public Boolean getOptional() {
    return optional;
  }


  @JsonProperty(JSON_PROPERTY_OPTIONAL)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setOptional(Boolean optional) {
    this.optional = optional;
  }


  public SchemaDefinitionItem regex(String regex) {
    this.regex = regex;
    return this;
  }

  /**
   * Validation expression for text fields
   * @return regex
   */
  @javax.annotation.Nullable
  @JsonProperty(JSON_PROPERTY_REGEX)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public String getRegex() {
    return regex;
  }


  @JsonProperty(JSON_PROPERTY_REGEX)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setRegex(String regex) {
    this.regex = regex;
  }


  public SchemaDefinitionItem title(String title) {
    this.title = title;
    return this;
  }

  /**
   * Label for the property
   * @return title
   */
  @javax.annotation.Nonnull
  @JsonProperty(JSON_PROPERTY_TITLE)
  @JsonInclude(value = JsonInclude.Include.ALWAYS)
  public String getTitle() {
    return title;
  }


  @JsonProperty(JSON_PROPERTY_TITLE)
  @JsonInclude(value = JsonInclude.Include.ALWAYS)
  public void setTitle(String title) {
    this.title = title;
  }


  public SchemaDefinitionItem type(SchemaValueDataType type) {
    this.type = type;
    return this;
  }

  /**
   * Get type
   * @return type
   */
  @javax.annotation.Nonnull
  @JsonProperty(JSON_PROPERTY_TYPE)
  @JsonInclude(value = JsonInclude.Include.ALWAYS)
  public SchemaValueDataType getType() {
    return type;
  }


  @JsonProperty(JSON_PROPERTY_TYPE)
  @JsonInclude(value = JsonInclude.Include.ALWAYS)
  public void setType(SchemaValueDataType type) {
    this.type = type;
  }


  public SchemaDefinitionItem values(List values) {
    this.values = values;
    return this;
  }

  public SchemaDefinitionItem addValuesItem(String valuesItem) {
    if (this.values == null) {
      this.values = new ArrayList<>();
    }
    this.values.add(valuesItem);
    return this;
  }

  /**
   * List of selectable values for text fields
   * @return values
   */
  @javax.annotation.Nullable
  @JsonProperty(JSON_PROPERTY_VALUES)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public List getValues() {
    return values;
  }


  @JsonProperty(JSON_PROPERTY_VALUES)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setValues(List values) {
    this.values = values;
  }


  /**
   * Return true if this SchemaDefinitionItem object is equal to o.
   */
  @Override
  public boolean equals(Object o) {
    if (this == o) {
      return true;
    }
    if (o == null || getClass() != o.getClass()) {
      return false;
    }
    SchemaDefinitionItem schemaDefinitionItem = (SchemaDefinitionItem) o;
    return Objects.equals(this._default, schemaDefinitionItem._default) &&
        Objects.equals(this.description, schemaDefinitionItem.description) &&
        Objects.equals(this.group, schemaDefinitionItem.group) &&
        Objects.equals(this.length, schemaDefinitionItem.length) &&
        Objects.equals(this.max, schemaDefinitionItem.max) &&
        Objects.equals(this.min, schemaDefinitionItem.min) &&
        Objects.equals(this.name, schemaDefinitionItem.name) &&
        Objects.equals(this.optional, schemaDefinitionItem.optional) &&
        Objects.equals(this.regex, schemaDefinitionItem.regex) &&
        Objects.equals(this.title, schemaDefinitionItem.title) &&
        Objects.equals(this.type, schemaDefinitionItem.type) &&
        Objects.equals(this.values, schemaDefinitionItem.values);
  }

  @Override
  public int hashCode() {
    return Objects.hash(_default, description, group, length, max, min, name, optional, regex, title, type, values);
  }

  @Override
  public String toString() {
    StringBuilder sb = new StringBuilder();
    sb.append("class SchemaDefinitionItem {\n");
    sb.append("    _default: ").append(toIndentedString(_default)).append("\n");
    sb.append("    description: ").append(toIndentedString(description)).append("\n");
    sb.append("    group: ").append(toIndentedString(group)).append("\n");
    sb.append("    length: ").append(toIndentedString(length)).append("\n");
    sb.append("    max: ").append(toIndentedString(max)).append("\n");
    sb.append("    min: ").append(toIndentedString(min)).append("\n");
    sb.append("    name: ").append(toIndentedString(name)).append("\n");
    sb.append("    optional: ").append(toIndentedString(optional)).append("\n");
    sb.append("    regex: ").append(toIndentedString(regex)).append("\n");
    sb.append("    title: ").append(toIndentedString(title)).append("\n");
    sb.append("    type: ").append(toIndentedString(type)).append("\n");
    sb.append("    values: ").append(toIndentedString(values)).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    ");
  }

  /**
   * Convert the instance into URL query string.
   *
   * @return URL query string
   */
  public String toUrlQueryString() {
    return toUrlQueryString(null);
  }

  /**
   * Convert the instance into URL query string.
   *
   * @param prefix prefix of the query string
   * @return URL query string
   */
  public String toUrlQueryString(String prefix) {
    String suffix = "";
    String containerSuffix = "";
    String containerPrefix = "";
    if (prefix == null) {
      // style=form, explode=true, e.g. /pet?name=cat&type=manx
      prefix = "";
    } else {
      // deepObject style e.g. /pet?id[name]=cat&id[type]=manx
      prefix = prefix + "[";
      suffix = "]";
      containerSuffix = "]";
      containerPrefix = "[";
    }

    StringJoiner joiner = new StringJoiner("&");

    // add `default` to the URL query string
    if (getDefault() != null) {
      joiner.add(String.format("%sdefault%s=%s", prefix, suffix, URLEncoder.encode(ApiClient.valueToString(getDefault()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
    }

    // add `description` to the URL query string
    if (getDescription() != null) {
      joiner.add(String.format("%sdescription%s=%s", prefix, suffix, URLEncoder.encode(ApiClient.valueToString(getDescription()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
    }

    // add `group` to the URL query string
    if (getGroup() != null) {
      joiner.add(String.format("%sgroup%s=%s", prefix, suffix, URLEncoder.encode(ApiClient.valueToString(getGroup()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
    }

    // add `length` to the URL query string
    if (getLength() != null) {
      joiner.add(String.format("%slength%s=%s", prefix, suffix, URLEncoder.encode(ApiClient.valueToString(getLength()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
    }

    // add `max` to the URL query string
    if (getMax() != null) {
      joiner.add(String.format("%smax%s=%s", prefix, suffix, URLEncoder.encode(ApiClient.valueToString(getMax()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
    }

    // add `min` to the URL query string
    if (getMin() != null) {
      joiner.add(String.format("%smin%s=%s", prefix, suffix, URLEncoder.encode(ApiClient.valueToString(getMin()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
    }

    // add `name` to the URL query string
    if (getName() != null) {
      joiner.add(String.format("%sname%s=%s", prefix, suffix, URLEncoder.encode(ApiClient.valueToString(getName()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
    }

    // add `optional` to the URL query string
    if (getOptional() != null) {
      joiner.add(String.format("%soptional%s=%s", prefix, suffix, URLEncoder.encode(ApiClient.valueToString(getOptional()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
    }

    // add `regex` to the URL query string
    if (getRegex() != null) {
      joiner.add(String.format("%sregex%s=%s", prefix, suffix, URLEncoder.encode(ApiClient.valueToString(getRegex()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
    }

    // add `title` to the URL query string
    if (getTitle() != null) {
      joiner.add(String.format("%stitle%s=%s", prefix, suffix, URLEncoder.encode(ApiClient.valueToString(getTitle()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
    }

    // add `type` to the URL query string
    if (getType() != null) {
      joiner.add(String.format("%stype%s=%s", prefix, suffix, URLEncoder.encode(ApiClient.valueToString(getType()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
    }

    // add `values` to the URL query string
    if (getValues() != null) {
      for (int i = 0; i < getValues().size(); i++) {
        joiner.add(String.format("%svalues%s%s=%s", prefix, suffix,
            "".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix),
            URLEncoder.encode(ApiClient.valueToString(getValues().get(i)), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
      }
    }

    return joiner.toString();
  }
}





© 2015 - 2025 Weber Informatics LLC | Privacy Policy