001package com.box.sdkgen.schemas.metadatataxonomy;
002
003import com.box.sdkgen.internal.NullableFieldTracker;
004import com.box.sdkgen.internal.SerializableObject;
005import com.box.sdkgen.schemas.metadatataxonomylevel.MetadataTaxonomyLevel;
006import com.fasterxml.jackson.annotation.JsonFilter;
007import com.fasterxml.jackson.annotation.JsonProperty;
008import java.util.List;
009import java.util.Objects;
010
011/** A taxonomy object for metadata that can be used in metadata templates. */
012@JsonFilter("nullablePropertyFilter")
013public class MetadataTaxonomy extends SerializableObject {
014
015  /** A unique identifier of the metadata taxonomy. */
016  protected final String id;
017
018  /**
019   * A unique identifier of the metadata taxonomy. The identifier must be unique within the
020   * namespace to which it belongs.
021   */
022  protected String key;
023
024  /** The display name of the metadata taxonomy. This can be seen in the Box web app. */
025  protected final String displayName;
026
027  /** A namespace that the metadata taxonomy is associated with. */
028  protected final String namespace;
029
030  /** Levels of the metadata taxonomy. */
031  protected List<MetadataTaxonomyLevel> levels;
032
033  public MetadataTaxonomy(
034      @JsonProperty("id") String id,
035      @JsonProperty("displayName") String displayName,
036      @JsonProperty("namespace") String namespace) {
037    super();
038    this.id = id;
039    this.displayName = displayName;
040    this.namespace = namespace;
041  }
042
043  protected MetadataTaxonomy(Builder builder) {
044    super();
045    this.id = builder.id;
046    this.key = builder.key;
047    this.displayName = builder.displayName;
048    this.namespace = builder.namespace;
049    this.levels = builder.levels;
050    markNullableFieldsAsSet(builder.getExplicitlySetNullableFields());
051  }
052
053  public String getId() {
054    return id;
055  }
056
057  public String getKey() {
058    return key;
059  }
060
061  public String getDisplayName() {
062    return displayName;
063  }
064
065  public String getNamespace() {
066    return namespace;
067  }
068
069  public List<MetadataTaxonomyLevel> getLevels() {
070    return levels;
071  }
072
073  @Override
074  public boolean equals(Object o) {
075    if (this == o) {
076      return true;
077    }
078    if (o == null || getClass() != o.getClass()) {
079      return false;
080    }
081    MetadataTaxonomy casted = (MetadataTaxonomy) o;
082    return Objects.equals(id, casted.id)
083        && Objects.equals(key, casted.key)
084        && Objects.equals(displayName, casted.displayName)
085        && Objects.equals(namespace, casted.namespace)
086        && Objects.equals(levels, casted.levels);
087  }
088
089  @Override
090  public int hashCode() {
091    return Objects.hash(id, key, displayName, namespace, levels);
092  }
093
094  @Override
095  public String toString() {
096    return "MetadataTaxonomy{"
097        + "id='"
098        + id
099        + '\''
100        + ", "
101        + "key='"
102        + key
103        + '\''
104        + ", "
105        + "displayName='"
106        + displayName
107        + '\''
108        + ", "
109        + "namespace='"
110        + namespace
111        + '\''
112        + ", "
113        + "levels='"
114        + levels
115        + '\''
116        + "}";
117  }
118
119  public static class Builder extends NullableFieldTracker {
120
121    protected final String id;
122
123    protected String key;
124
125    protected final String displayName;
126
127    protected final String namespace;
128
129    protected List<MetadataTaxonomyLevel> levels;
130
131    public Builder(String id, String displayName, String namespace) {
132      super();
133      this.id = id;
134      this.displayName = displayName;
135      this.namespace = namespace;
136    }
137
138    public Builder key(String key) {
139      this.key = key;
140      return this;
141    }
142
143    public Builder levels(List<MetadataTaxonomyLevel> levels) {
144      this.levels = levels;
145      return this;
146    }
147
148    public MetadataTaxonomy build() {
149      return new MetadataTaxonomy(this);
150    }
151  }
152}