001package com.box.sdkgen.schemas.fileversionmini; 002 003import com.box.sdkgen.schemas.fileversionbase.FileVersionBase; 004import com.box.sdkgen.schemas.fileversionbase.FileVersionBaseTypeField; 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/** A mini representation of a file version, used when nested within another resource. */ 011@JsonFilter("nullablePropertyFilter") 012public class FileVersionMini extends FileVersionBase { 013 014 /** The SHA1 hash of this version of the file. */ 015 protected String sha1; 016 017 public FileVersionMini(@JsonProperty("id") String id) { 018 super(id); 019 } 020 021 protected FileVersionMini(Builder builder) { 022 super(builder); 023 this.sha1 = builder.sha1; 024 markNullableFieldsAsSet(builder.getExplicitlySetNullableFields()); 025 } 026 027 public String getSha1() { 028 return sha1; 029 } 030 031 @Override 032 public boolean equals(Object o) { 033 if (this == o) { 034 return true; 035 } 036 if (o == null || getClass() != o.getClass()) { 037 return false; 038 } 039 FileVersionMini casted = (FileVersionMini) o; 040 return Objects.equals(id, casted.id) 041 && Objects.equals(type, casted.type) 042 && Objects.equals(sha1, casted.sha1); 043 } 044 045 @Override 046 public int hashCode() { 047 return Objects.hash(id, type, sha1); 048 } 049 050 @Override 051 public String toString() { 052 return "FileVersionMini{" 053 + "id='" 054 + id 055 + '\'' 056 + ", " 057 + "type='" 058 + type 059 + '\'' 060 + ", " 061 + "sha1='" 062 + sha1 063 + '\'' 064 + "}"; 065 } 066 067 public static class Builder extends FileVersionBase.Builder { 068 069 protected String sha1; 070 071 public Builder(String id) { 072 super(id); 073 } 074 075 public Builder sha1(String sha1) { 076 this.sha1 = sha1; 077 return this; 078 } 079 080 @Override 081 public Builder type(FileVersionBaseTypeField type) { 082 this.type = new EnumWrapper<FileVersionBaseTypeField>(type); 083 return this; 084 } 085 086 @Override 087 public Builder type(EnumWrapper<FileVersionBaseTypeField> type) { 088 this.type = type; 089 return this; 090 } 091 092 public FileVersionMini build() { 093 if (this.type == null) { 094 this.type = 095 new EnumWrapper<FileVersionBaseTypeField>(FileVersionBaseTypeField.FILE_VERSION); 096 } 097 return new FileVersionMini(this); 098 } 099 } 100}