001package com.box.sdkgen.schemas.uploadpart; 002 003import com.box.sdkgen.schemas.uploadpartmini.UploadPartMini; 004import com.fasterxml.jackson.annotation.JsonFilter; 005import java.util.Objects; 006 007/** The representation of an upload session chunk. */ 008@JsonFilter("nullablePropertyFilter") 009public class UploadPart extends UploadPartMini { 010 011 /** The SHA1 hash of the chunk. */ 012 protected String sha1; 013 014 public UploadPart() { 015 super(); 016 } 017 018 protected UploadPart(Builder builder) { 019 super(builder); 020 this.sha1 = builder.sha1; 021 markNullableFieldsAsSet(builder.getExplicitlySetNullableFields()); 022 } 023 024 public String getSha1() { 025 return sha1; 026 } 027 028 @Override 029 public boolean equals(Object o) { 030 if (this == o) { 031 return true; 032 } 033 if (o == null || getClass() != o.getClass()) { 034 return false; 035 } 036 UploadPart casted = (UploadPart) o; 037 return Objects.equals(partId, casted.partId) 038 && Objects.equals(offset, casted.offset) 039 && Objects.equals(size, casted.size) 040 && Objects.equals(sha1, casted.sha1); 041 } 042 043 @Override 044 public int hashCode() { 045 return Objects.hash(partId, offset, size, sha1); 046 } 047 048 @Override 049 public String toString() { 050 return "UploadPart{" 051 + "partId='" 052 + partId 053 + '\'' 054 + ", " 055 + "offset='" 056 + offset 057 + '\'' 058 + ", " 059 + "size='" 060 + size 061 + '\'' 062 + ", " 063 + "sha1='" 064 + sha1 065 + '\'' 066 + "}"; 067 } 068 069 public static class Builder extends UploadPartMini.Builder { 070 071 protected String sha1; 072 073 public Builder sha1(String sha1) { 074 this.sha1 = sha1; 075 return this; 076 } 077 078 @Override 079 public Builder partId(String partId) { 080 this.partId = partId; 081 return this; 082 } 083 084 @Override 085 public Builder offset(Long offset) { 086 this.offset = offset; 087 return this; 088 } 089 090 @Override 091 public Builder size(Long size) { 092 this.size = size; 093 return this; 094 } 095 096 public UploadPart build() { 097 return new UploadPart(this); 098 } 099 } 100}