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

com.dominodatalab.pub.model.ConstraintSchemaDefinition 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.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;
/**
 * ConstraintSchemaDefinition
 */
@JsonPropertyOrder({
  ConstraintSchemaDefinition.JSON_PROPERTY_DEFAULT,
  ConstraintSchemaDefinition.JSON_PROPERTY_LENGTH,
  ConstraintSchemaDefinition.JSON_PROPERTY_MAX,
  ConstraintSchemaDefinition.JSON_PROPERTY_MIN,
  ConstraintSchemaDefinition.JSON_PROPERTY_NAME,
  ConstraintSchemaDefinition.JSON_PROPERTY_OVERRIDE,
  ConstraintSchemaDefinition.JSON_PROPERTY_REGEX,
  ConstraintSchemaDefinition.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 ConstraintSchemaDefinition {
  public static final String JSON_PROPERTY_DEFAULT = "default";
  private String _default;

  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_OVERRIDE = "override";
  private String override;

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

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

  public ConstraintSchemaDefinition() { 
  }

  public ConstraintSchemaDefinition _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 ConstraintSchemaDefinition 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 ConstraintSchemaDefinition 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 ConstraintSchemaDefinition 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 ConstraintSchemaDefinition 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 ConstraintSchemaDefinition override(String override) {
    this.override = override;
    return this;
  }

  /**
   * Get override
   * @return override
   */
  @javax.annotation.Nullable
  @JsonProperty(JSON_PROPERTY_OVERRIDE)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public String getOverride() {
    return override;
  }


  @JsonProperty(JSON_PROPERTY_OVERRIDE)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setOverride(String override) {
    this.override = override;
  }


  public ConstraintSchemaDefinition 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 ConstraintSchemaDefinition values(List values) {
    this.values = values;
    return this;
  }

  public ConstraintSchemaDefinition 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 ConstraintSchemaDefinition object is equal to o.
   */
  @Override
  public boolean equals(Object o) {
    if (this == o) {
      return true;
    }
    if (o == null || getClass() != o.getClass()) {
      return false;
    }
    ConstraintSchemaDefinition constraintSchemaDefinition = (ConstraintSchemaDefinition) o;
    return Objects.equals(this._default, constraintSchemaDefinition._default) &&
        Objects.equals(this.length, constraintSchemaDefinition.length) &&
        Objects.equals(this.max, constraintSchemaDefinition.max) &&
        Objects.equals(this.min, constraintSchemaDefinition.min) &&
        Objects.equals(this.name, constraintSchemaDefinition.name) &&
        Objects.equals(this.override, constraintSchemaDefinition.override) &&
        Objects.equals(this.regex, constraintSchemaDefinition.regex) &&
        Objects.equals(this.values, constraintSchemaDefinition.values);
  }

  @Override
  public int hashCode() {
    return Objects.hash(_default, length, max, min, name, override, regex, values);
  }

  @Override
  public String toString() {
    StringBuilder sb = new StringBuilder();
    sb.append("class ConstraintSchemaDefinition {\n");
    sb.append("    _default: ").append(toIndentedString(_default)).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("    override: ").append(toIndentedString(override)).append("\n");
    sb.append("    regex: ").append(toIndentedString(regex)).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 `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 `override` to the URL query string
    if (getOverride() != null) {
      joiner.add(String.format("%soverride%s=%s", prefix, suffix, URLEncoder.encode(ApiClient.valueToString(getOverride()), 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 `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