001package com.box.sdkgen.schemas.weblinkmini;
002
003import com.box.sdkgen.schemas.weblinkbase.WebLinkBase;
004import com.box.sdkgen.schemas.weblinkbase.WebLinkBaseTypeField;
005import com.box.sdkgen.serialization.json.EnumWrapper;
006import com.fasterxml.jackson.annotation.JsonFilter;
007import com.fasterxml.jackson.annotation.JsonProperty;
008import java.util.Objects;
009
010/**
011 * Web links are objects that point to URLs. These objects are also known as bookmarks within the
012 * Box web application.
013 *
014 * <p>Web link objects are treated similarly to file objects, they will also support most actions
015 * that apply to regular files.
016 */
017@JsonFilter("nullablePropertyFilter")
018public class WebLinkMini extends WebLinkBase {
019
020  /** The URL this web link points to. */
021  protected String url;
022
023  @JsonProperty("sequence_id")
024  protected String sequenceId;
025
026  /** The name of the web link. */
027  protected String name;
028
029  public WebLinkMini(@JsonProperty("id") String id) {
030    super(id);
031  }
032
033  protected WebLinkMini(Builder builder) {
034    super(builder);
035    this.url = builder.url;
036    this.sequenceId = builder.sequenceId;
037    this.name = builder.name;
038    markNullableFieldsAsSet(builder.getExplicitlySetNullableFields());
039  }
040
041  public String getUrl() {
042    return url;
043  }
044
045  public String getSequenceId() {
046    return sequenceId;
047  }
048
049  public String getName() {
050    return name;
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    WebLinkMini casted = (WebLinkMini) o;
062    return Objects.equals(id, casted.id)
063        && Objects.equals(type, casted.type)
064        && Objects.equals(etag, casted.etag)
065        && Objects.equals(url, casted.url)
066        && Objects.equals(sequenceId, casted.sequenceId)
067        && Objects.equals(name, casted.name);
068  }
069
070  @Override
071  public int hashCode() {
072    return Objects.hash(id, type, etag, url, sequenceId, name);
073  }
074
075  @Override
076  public String toString() {
077    return "WebLinkMini{"
078        + "id='"
079        + id
080        + '\''
081        + ", "
082        + "type='"
083        + type
084        + '\''
085        + ", "
086        + "etag='"
087        + etag
088        + '\''
089        + ", "
090        + "url='"
091        + url
092        + '\''
093        + ", "
094        + "sequenceId='"
095        + sequenceId
096        + '\''
097        + ", "
098        + "name='"
099        + name
100        + '\''
101        + "}";
102  }
103
104  public static class Builder extends WebLinkBase.Builder {
105
106    protected String url;
107
108    protected String sequenceId;
109
110    protected String name;
111
112    public Builder(String id) {
113      super(id);
114    }
115
116    public Builder url(String url) {
117      this.url = url;
118      return this;
119    }
120
121    public Builder sequenceId(String sequenceId) {
122      this.sequenceId = sequenceId;
123      return this;
124    }
125
126    public Builder name(String name) {
127      this.name = name;
128      return this;
129    }
130
131    @Override
132    public Builder type(WebLinkBaseTypeField type) {
133      this.type = new EnumWrapper<WebLinkBaseTypeField>(type);
134      return this;
135    }
136
137    @Override
138    public Builder type(EnumWrapper<WebLinkBaseTypeField> type) {
139      this.type = type;
140      return this;
141    }
142
143    @Override
144    public Builder etag(String etag) {
145      this.etag = etag;
146      return this;
147    }
148
149    public WebLinkMini build() {
150      if (this.type == null) {
151        this.type = new EnumWrapper<WebLinkBaseTypeField>(WebLinkBaseTypeField.WEB_LINK);
152      }
153      return new WebLinkMini(this);
154    }
155  }
156}