001package com.box.sdkgen.schemas.uploadpartmini;
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/** The basic representation of an upload session chunk. */
010@JsonFilter("nullablePropertyFilter")
011public class UploadPartMini extends SerializableObject {
012
013  /** The unique ID of the chunk. */
014  @JsonProperty("part_id")
015  protected String partId;
016
017  /**
018   * The offset of the chunk within the file in bytes. The lower bound of the position of the chunk
019   * within the file.
020   */
021  protected Long offset;
022
023  /** The size of the chunk in bytes. */
024  protected Long size;
025
026  public UploadPartMini() {
027    super();
028  }
029
030  protected UploadPartMini(Builder builder) {
031    super();
032    this.partId = builder.partId;
033    this.offset = builder.offset;
034    this.size = builder.size;
035    markNullableFieldsAsSet(builder.getExplicitlySetNullableFields());
036  }
037
038  public String getPartId() {
039    return partId;
040  }
041
042  public Long getOffset() {
043    return offset;
044  }
045
046  public Long getSize() {
047    return size;
048  }
049
050  @Override
051  public boolean equals(Object o) {
052    if (this == o) {
053      return true;
054    }
055    if (o == null || getClass() != o.getClass()) {
056      return false;
057    }
058    UploadPartMini casted = (UploadPartMini) o;
059    return Objects.equals(partId, casted.partId)
060        && Objects.equals(offset, casted.offset)
061        && Objects.equals(size, casted.size);
062  }
063
064  @Override
065  public int hashCode() {
066    return Objects.hash(partId, offset, size);
067  }
068
069  @Override
070  public String toString() {
071    return "UploadPartMini{"
072        + "partId='"
073        + partId
074        + '\''
075        + ", "
076        + "offset='"
077        + offset
078        + '\''
079        + ", "
080        + "size='"
081        + size
082        + '\''
083        + "}";
084  }
085
086  public static class Builder extends NullableFieldTracker {
087
088    protected String partId;
089
090    protected Long offset;
091
092    protected Long size;
093
094    public Builder partId(String partId) {
095      this.partId = partId;
096      return this;
097    }
098
099    public Builder offset(Long offset) {
100      this.offset = offset;
101      return this;
102    }
103
104    public Builder size(Long size) {
105      this.size = size;
106      return this;
107    }
108
109    public UploadPartMini build() {
110      return new UploadPartMini(this);
111    }
112  }
113}