001package com.box.sdkgen.schemas.filemini; 002 003import com.box.sdkgen.schemas.filebase.FileBase; 004import com.box.sdkgen.schemas.filebase.FileBaseTypeField; 005import com.box.sdkgen.schemas.fileversionmini.FileVersionMini; 006import com.box.sdkgen.serialization.json.EnumWrapper; 007import com.fasterxml.jackson.annotation.JsonFilter; 008import com.fasterxml.jackson.annotation.JsonProperty; 009import java.util.Objects; 010 011/** A mini representation of a file, used when nested under another resource. */ 012@JsonFilter("nullablePropertyFilter") 013public class FileMini extends FileBase { 014 015 @JsonProperty("sequence_id") 016 protected String sequenceId; 017 018 /** The name of the file. */ 019 protected String name; 020 021 /** 022 * The SHA1 hash of the file. This can be used to compare the contents of a file on Box with a 023 * local file. 024 */ 025 protected String sha1; 026 027 @JsonProperty("file_version") 028 protected FileVersionMini fileVersion; 029 030 public FileMini(@JsonProperty("id") String id) { 031 super(id); 032 } 033 034 protected FileMini(Builder builder) { 035 super(builder); 036 this.sequenceId = builder.sequenceId; 037 this.name = builder.name; 038 this.sha1 = builder.sha1; 039 this.fileVersion = builder.fileVersion; 040 markNullableFieldsAsSet(builder.getExplicitlySetNullableFields()); 041 } 042 043 public String getSequenceId() { 044 return sequenceId; 045 } 046 047 public String getName() { 048 return name; 049 } 050 051 public String getSha1() { 052 return sha1; 053 } 054 055 public FileVersionMini getFileVersion() { 056 return fileVersion; 057 } 058 059 @Override 060 public boolean equals(Object o) { 061 if (this == o) { 062 return true; 063 } 064 if (o == null || getClass() != o.getClass()) { 065 return false; 066 } 067 FileMini casted = (FileMini) o; 068 return Objects.equals(id, casted.id) 069 && Objects.equals(etag, casted.etag) 070 && Objects.equals(type, casted.type) 071 && Objects.equals(sequenceId, casted.sequenceId) 072 && Objects.equals(name, casted.name) 073 && Objects.equals(sha1, casted.sha1) 074 && Objects.equals(fileVersion, casted.fileVersion); 075 } 076 077 @Override 078 public int hashCode() { 079 return Objects.hash(id, etag, type, sequenceId, name, sha1, fileVersion); 080 } 081 082 @Override 083 public String toString() { 084 return "FileMini{" 085 + "id='" 086 + id 087 + '\'' 088 + ", " 089 + "etag='" 090 + etag 091 + '\'' 092 + ", " 093 + "type='" 094 + type 095 + '\'' 096 + ", " 097 + "sequenceId='" 098 + sequenceId 099 + '\'' 100 + ", " 101 + "name='" 102 + name 103 + '\'' 104 + ", " 105 + "sha1='" 106 + sha1 107 + '\'' 108 + ", " 109 + "fileVersion='" 110 + fileVersion 111 + '\'' 112 + "}"; 113 } 114 115 public static class Builder extends FileBase.Builder { 116 117 protected String sequenceId; 118 119 protected String name; 120 121 protected String sha1; 122 123 protected FileVersionMini fileVersion; 124 125 public Builder(String id) { 126 super(id); 127 } 128 129 public Builder sequenceId(String sequenceId) { 130 this.sequenceId = sequenceId; 131 return this; 132 } 133 134 public Builder name(String name) { 135 this.name = name; 136 return this; 137 } 138 139 public Builder sha1(String sha1) { 140 this.sha1 = sha1; 141 return this; 142 } 143 144 public Builder fileVersion(FileVersionMini fileVersion) { 145 this.fileVersion = fileVersion; 146 return this; 147 } 148 149 @Override 150 public Builder etag(String etag) { 151 this.etag = etag; 152 this.markNullableFieldAsSet("etag"); 153 return this; 154 } 155 156 @Override 157 public Builder type(FileBaseTypeField type) { 158 this.type = new EnumWrapper<FileBaseTypeField>(type); 159 return this; 160 } 161 162 @Override 163 public Builder type(EnumWrapper<FileBaseTypeField> type) { 164 this.type = type; 165 return this; 166 } 167 168 public FileMini build() { 169 if (this.type == null) { 170 this.type = new EnumWrapper<FileBaseTypeField>(FileBaseTypeField.FILE); 171 } 172 return new FileMini(this); 173 } 174 } 175}