001// Automatically generated by the Thrifty compiler; do not edit! 002// Generated on: 2021-05-17T06:20:27.418Z 003// Source: J:\facedb\facedb-service\FaceDb.thrift at 52:1 004package net.gdface.facedb.thrift.client; 005 006import com.microsoft.thrifty.Adapter; 007import com.microsoft.thrifty.Struct; 008import com.microsoft.thrifty.StructBuilder; 009import com.microsoft.thrifty.TType; 010import com.microsoft.thrifty.ThriftField; 011import com.microsoft.thrifty.protocol.FieldMetadata; 012import com.microsoft.thrifty.protocol.Protocol; 013import com.microsoft.thrifty.util.ProtocolUtil; 014import java.io.IOException; 015import javax.annotation.Generated; 016import okio.ByteString; 017 018@Generated( 019 value = "com.microsoft.thrifty.gen.ThriftyCodeGenerator", 020 comments = "https://github.com/microsoft/thrifty" 021) 022public final class FeatureBean implements Struct { 023 public static final Adapter<FeatureBean, Builder> ADAPTER = new FeatureBeanAdapter(); 024 025 @ThriftField( 026 fieldId = 1, 027 isRequired = true 028 ) 029 public final Boolean _new; 030 031 @ThriftField( 032 fieldId = 2, 033 isRequired = true 034 ) 035 public final Integer modified; 036 037 @ThriftField( 038 fieldId = 3, 039 isRequired = true 040 ) 041 public final Integer initialized; 042 043 @ThriftField( 044 fieldId = 4, 045 isOptional = true 046 ) 047 public final String md5; 048 049 @ThriftField( 050 fieldId = 5, 051 isOptional = true 052 ) 053 public final ByteString feature; 054 055 @ThriftField( 056 fieldId = 6, 057 isOptional = true 058 ) 059 public final Long createTime; 060 061 private FeatureBean(Builder builder) { 062 this._new = builder._new; 063 this.modified = builder.modified; 064 this.initialized = builder.initialized; 065 this.md5 = builder.md5; 066 this.feature = builder.feature; 067 this.createTime = builder.createTime; 068 } 069 070 @Override 071 @SuppressWarnings({"NumberEquality", "StringEquality"}) 072 public boolean equals(Object other) { 073 if (this == other) return true; 074 if (other == null) return false; 075 if (!(other instanceof FeatureBean)) return false; 076 FeatureBean that = (FeatureBean) other; 077 return (this._new == that._new || this._new.equals(that._new)) 078 && (this.modified == that.modified || this.modified.equals(that.modified)) 079 && (this.initialized == that.initialized || this.initialized.equals(that.initialized)) 080 && (this.md5 == that.md5 || (this.md5 != null && this.md5.equals(that.md5))) 081 && (this.feature == that.feature || (this.feature != null && this.feature.equals(that.feature))) 082 && (this.createTime == that.createTime || (this.createTime != null && this.createTime.equals(that.createTime))); 083 } 084 085 @Override 086 public int hashCode() { 087 int code = 16777619; 088 code ^= this._new.hashCode(); 089 code *= 0x811c9dc5; 090 code ^= this.modified.hashCode(); 091 code *= 0x811c9dc5; 092 code ^= this.initialized.hashCode(); 093 code *= 0x811c9dc5; 094 code ^= (this.md5 == null) ? 0 : this.md5.hashCode(); 095 code *= 0x811c9dc5; 096 code ^= (this.feature == null) ? 0 : this.feature.hashCode(); 097 code *= 0x811c9dc5; 098 code ^= (this.createTime == null) ? 0 : this.createTime.hashCode(); 099 code *= 0x811c9dc5; 100 return code; 101 } 102 103 @Override 104 public String toString() { 105 return "FeatureBean{_new=" + this._new + ", modified=" + this.modified + ", initialized=" + this.initialized + ", md5=" + this.md5 + ", feature=" + this.feature + ", createTime=" + this.createTime + "}"; 106 } 107 108 @Override 109 public void write(Protocol protocol) throws IOException { 110 ADAPTER.write(protocol, this); 111 } 112 113 public static final class Builder implements StructBuilder<FeatureBean> { 114 private Boolean _new; 115 116 private Integer modified; 117 118 private Integer initialized; 119 120 private String md5; 121 122 private ByteString feature; 123 124 private Long createTime; 125 126 public Builder() { 127 } 128 129 public Builder(FeatureBean struct) { 130 this._new = struct._new; 131 this.modified = struct.modified; 132 this.initialized = struct.initialized; 133 this.md5 = struct.md5; 134 this.feature = struct.feature; 135 this.createTime = struct.createTime; 136 } 137 138 public Builder _new(Boolean _new) { 139 if (_new == null) { 140 throw new NullPointerException("Required field '_new' cannot be null"); 141 } 142 this._new = _new; 143 return this; 144 } 145 146 public Builder modified(Integer modified) { 147 if (modified == null) { 148 throw new NullPointerException("Required field 'modified' cannot be null"); 149 } 150 this.modified = modified; 151 return this; 152 } 153 154 public Builder initialized(Integer initialized) { 155 if (initialized == null) { 156 throw new NullPointerException("Required field 'initialized' cannot be null"); 157 } 158 this.initialized = initialized; 159 return this; 160 } 161 162 public Builder md5(String md5) { 163 this.md5 = md5; 164 return this; 165 } 166 167 public Builder feature(ByteString feature) { 168 this.feature = feature; 169 return this; 170 } 171 172 public Builder createTime(Long createTime) { 173 this.createTime = createTime; 174 return this; 175 } 176 177 @Override 178 public FeatureBean build() { 179 if (this._new == null) { 180 throw new IllegalStateException("Required field '_new' is missing"); 181 } 182 if (this.modified == null) { 183 throw new IllegalStateException("Required field 'modified' is missing"); 184 } 185 if (this.initialized == null) { 186 throw new IllegalStateException("Required field 'initialized' is missing"); 187 } 188 return new FeatureBean(this); 189 } 190 191 @Override 192 public void reset() { 193 this._new = null; 194 this.modified = null; 195 this.initialized = null; 196 this.md5 = null; 197 this.feature = null; 198 this.createTime = null; 199 } 200 } 201 202 private static final class FeatureBeanAdapter implements Adapter<FeatureBean, Builder> { 203 @Override 204 public void write(Protocol protocol, FeatureBean struct) throws IOException { 205 protocol.writeStructBegin("FeatureBean"); 206 protocol.writeFieldBegin("_new", 1, TType.BOOL); 207 protocol.writeBool(struct._new); 208 protocol.writeFieldEnd(); 209 protocol.writeFieldBegin("modified", 2, TType.I32); 210 protocol.writeI32(struct.modified); 211 protocol.writeFieldEnd(); 212 protocol.writeFieldBegin("initialized", 3, TType.I32); 213 protocol.writeI32(struct.initialized); 214 protocol.writeFieldEnd(); 215 if (struct.md5 != null) { 216 protocol.writeFieldBegin("md5", 4, TType.STRING); 217 protocol.writeString(struct.md5); 218 protocol.writeFieldEnd(); 219 } 220 if (struct.feature != null) { 221 protocol.writeFieldBegin("feature", 5, TType.STRING); 222 protocol.writeBinary(struct.feature); 223 protocol.writeFieldEnd(); 224 } 225 if (struct.createTime != null) { 226 protocol.writeFieldBegin("createTime", 6, TType.I64); 227 protocol.writeI64(struct.createTime); 228 protocol.writeFieldEnd(); 229 } 230 protocol.writeFieldStop(); 231 protocol.writeStructEnd(); 232 } 233 234 @Override 235 public FeatureBean read(Protocol protocol, Builder builder) throws IOException { 236 protocol.readStructBegin(); 237 while (true) { 238 FieldMetadata field = protocol.readFieldBegin(); 239 if (field.typeId == TType.STOP) { 240 break; 241 } 242 switch (field.fieldId) { 243 case 1: { 244 if (field.typeId == TType.BOOL) { 245 boolean value = protocol.readBool(); 246 builder._new(value); 247 } else { 248 ProtocolUtil.skip(protocol, field.typeId); 249 } 250 } 251 break; 252 case 2: { 253 if (field.typeId == TType.I32) { 254 int value = protocol.readI32(); 255 builder.modified(value); 256 } else { 257 ProtocolUtil.skip(protocol, field.typeId); 258 } 259 } 260 break; 261 case 3: { 262 if (field.typeId == TType.I32) { 263 int value = protocol.readI32(); 264 builder.initialized(value); 265 } else { 266 ProtocolUtil.skip(protocol, field.typeId); 267 } 268 } 269 break; 270 case 4: { 271 if (field.typeId == TType.STRING) { 272 String value = protocol.readString(); 273 builder.md5(value); 274 } else { 275 ProtocolUtil.skip(protocol, field.typeId); 276 } 277 } 278 break; 279 case 5: { 280 if (field.typeId == TType.STRING) { 281 ByteString value = protocol.readBinary(); 282 builder.feature(value); 283 } else { 284 ProtocolUtil.skip(protocol, field.typeId); 285 } 286 } 287 break; 288 case 6: { 289 if (field.typeId == TType.I64) { 290 long value = protocol.readI64(); 291 builder.createTime(value); 292 } else { 293 ProtocolUtil.skip(protocol, field.typeId); 294 } 295 } 296 break; 297 default: { 298 ProtocolUtil.skip(protocol, field.typeId); 299 } 300 break; 301 } 302 protocol.readFieldEnd(); 303 } 304 protocol.readStructEnd(); 305 return builder.build(); 306 } 307 308 @Override 309 public FeatureBean read(Protocol protocol) throws IOException { 310 return read(protocol, new Builder()); 311 } 312 } 313}