001package com.box.sdkgen.managers.metadatataxonomies;
002
003import com.box.sdkgen.internal.NullableFieldTracker;
004import com.box.sdkgen.internal.SerializableObject;
005import com.fasterxml.jackson.annotation.JsonFilter;
006import com.fasterxml.jackson.annotation.JsonProperty;
007import java.util.Objects;
008
009@JsonFilter("nullablePropertyFilter")
010public class CreateMetadataTaxonomyRequestBody extends SerializableObject {
011
012  /**
013   * The taxonomy key. If it is not provided in the request body, it will be generated from the
014   * `displayName`. The `displayName` would be converted to lower case, and all spaces and
015   * non-alphanumeric characters replaced with underscores.
016   */
017  protected String key;
018
019  /** The display name of the taxonomy. */
020  protected final String displayName;
021
022  /** The namespace of the metadata taxonomy to create. */
023  protected final String namespace;
024
025  public CreateMetadataTaxonomyRequestBody(
026      @JsonProperty("displayName") String displayName,
027      @JsonProperty("namespace") String namespace) {
028    super();
029    this.displayName = displayName;
030    this.namespace = namespace;
031  }
032
033  protected CreateMetadataTaxonomyRequestBody(Builder builder) {
034    super();
035    this.key = builder.key;
036    this.displayName = builder.displayName;
037    this.namespace = builder.namespace;
038    markNullableFieldsAsSet(builder.getExplicitlySetNullableFields());
039  }
040
041  public String getKey() {
042    return key;
043  }
044
045  public String getDisplayName() {
046    return displayName;
047  }
048
049  public String getNamespace() {
050    return namespace;
051  }
052
053  @Override
054  public boolean equals(Object o) {
055    if (this == o) {
056      return true;
057    }
058    if (o == null || getClass() != o.getClass()) {
059      return false;
060    }
061    CreateMetadataTaxonomyRequestBody casted = (CreateMetadataTaxonomyRequestBody) o;
062    return Objects.equals(key, casted.key)
063        && Objects.equals(displayName, casted.displayName)
064        && Objects.equals(namespace, casted.namespace);
065  }
066
067  @Override
068  public int hashCode() {
069    return Objects.hash(key, displayName, namespace);
070  }
071
072  @Override
073  public String toString() {
074    return "CreateMetadataTaxonomyRequestBody{"
075        + "key='"
076        + key
077        + '\''
078        + ", "
079        + "displayName='"
080        + displayName
081        + '\''
082        + ", "
083        + "namespace='"
084        + namespace
085        + '\''
086        + "}";
087  }
088
089  public static class Builder extends NullableFieldTracker {
090
091    protected String key;
092
093    protected final String displayName;
094
095    protected final String namespace;
096
097    public Builder(String displayName, String namespace) {
098      super();
099      this.displayName = displayName;
100      this.namespace = namespace;
101    }
102
103    public Builder key(String key) {
104      this.key = key;
105      return this;
106    }
107
108    public CreateMetadataTaxonomyRequestBody build() {
109      return new CreateMetadataTaxonomyRequestBody(this);
110    }
111  }
112}