001// Automatically generated by the Thrifty compiler; do not edit! 002// Generated on: 2021-05-17T06:20:27.416Z 003// Source: J:\facedb\facedb-service\FaceDb.thrift at 30: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; 016 017@Generated( 018 value = "com.microsoft.thrifty.gen.ThriftyCodeGenerator", 019 comments = "https://github.com/microsoft/thrifty" 020) 021public final class FRect implements Struct { 022 public static final Adapter<FRect, Builder> ADAPTER = new FRectAdapter(); 023 024 @ThriftField( 025 fieldId = 1, 026 isRequired = true 027 ) 028 public final Integer height; 029 030 @ThriftField( 031 fieldId = 2, 032 isRequired = true 033 ) 034 public final Integer left; 035 036 @ThriftField( 037 fieldId = 3, 038 isRequired = true 039 ) 040 public final Integer top; 041 042 @ThriftField( 043 fieldId = 4, 044 isRequired = true 045 ) 046 public final Integer width; 047 048 private FRect(Builder builder) { 049 this.height = builder.height; 050 this.left = builder.left; 051 this.top = builder.top; 052 this.width = builder.width; 053 } 054 055 @Override 056 @SuppressWarnings("NumberEquality") 057 public boolean equals(Object other) { 058 if (this == other) return true; 059 if (other == null) return false; 060 if (!(other instanceof FRect)) return false; 061 FRect that = (FRect) other; 062 return (this.height == that.height || this.height.equals(that.height)) 063 && (this.left == that.left || this.left.equals(that.left)) 064 && (this.top == that.top || this.top.equals(that.top)) 065 && (this.width == that.width || this.width.equals(that.width)); 066 } 067 068 @Override 069 public int hashCode() { 070 int code = 16777619; 071 code ^= this.height.hashCode(); 072 code *= 0x811c9dc5; 073 code ^= this.left.hashCode(); 074 code *= 0x811c9dc5; 075 code ^= this.top.hashCode(); 076 code *= 0x811c9dc5; 077 code ^= this.width.hashCode(); 078 code *= 0x811c9dc5; 079 return code; 080 } 081 082 @Override 083 public String toString() { 084 return "FRect{height=" + this.height + ", left=" + this.left + ", top=" + this.top + ", width=" + this.width + "}"; 085 } 086 087 @Override 088 public void write(Protocol protocol) throws IOException { 089 ADAPTER.write(protocol, this); 090 } 091 092 public static final class Builder implements StructBuilder<FRect> { 093 private Integer height; 094 095 private Integer left; 096 097 private Integer top; 098 099 private Integer width; 100 101 public Builder() { 102 } 103 104 public Builder(FRect struct) { 105 this.height = struct.height; 106 this.left = struct.left; 107 this.top = struct.top; 108 this.width = struct.width; 109 } 110 111 public Builder height(Integer height) { 112 if (height == null) { 113 throw new NullPointerException("Required field 'height' cannot be null"); 114 } 115 this.height = height; 116 return this; 117 } 118 119 public Builder left(Integer left) { 120 if (left == null) { 121 throw new NullPointerException("Required field 'left' cannot be null"); 122 } 123 this.left = left; 124 return this; 125 } 126 127 public Builder top(Integer top) { 128 if (top == null) { 129 throw new NullPointerException("Required field 'top' cannot be null"); 130 } 131 this.top = top; 132 return this; 133 } 134 135 public Builder width(Integer width) { 136 if (width == null) { 137 throw new NullPointerException("Required field 'width' cannot be null"); 138 } 139 this.width = width; 140 return this; 141 } 142 143 @Override 144 public FRect build() { 145 if (this.height == null) { 146 throw new IllegalStateException("Required field 'height' is missing"); 147 } 148 if (this.left == null) { 149 throw new IllegalStateException("Required field 'left' is missing"); 150 } 151 if (this.top == null) { 152 throw new IllegalStateException("Required field 'top' is missing"); 153 } 154 if (this.width == null) { 155 throw new IllegalStateException("Required field 'width' is missing"); 156 } 157 return new FRect(this); 158 } 159 160 @Override 161 public void reset() { 162 this.height = null; 163 this.left = null; 164 this.top = null; 165 this.width = null; 166 } 167 } 168 169 private static final class FRectAdapter implements Adapter<FRect, Builder> { 170 @Override 171 public void write(Protocol protocol, FRect struct) throws IOException { 172 protocol.writeStructBegin("FRect"); 173 protocol.writeFieldBegin("height", 1, TType.I32); 174 protocol.writeI32(struct.height); 175 protocol.writeFieldEnd(); 176 protocol.writeFieldBegin("left", 2, TType.I32); 177 protocol.writeI32(struct.left); 178 protocol.writeFieldEnd(); 179 protocol.writeFieldBegin("top", 3, TType.I32); 180 protocol.writeI32(struct.top); 181 protocol.writeFieldEnd(); 182 protocol.writeFieldBegin("width", 4, TType.I32); 183 protocol.writeI32(struct.width); 184 protocol.writeFieldEnd(); 185 protocol.writeFieldStop(); 186 protocol.writeStructEnd(); 187 } 188 189 @Override 190 public FRect read(Protocol protocol, Builder builder) throws IOException { 191 protocol.readStructBegin(); 192 while (true) { 193 FieldMetadata field = protocol.readFieldBegin(); 194 if (field.typeId == TType.STOP) { 195 break; 196 } 197 switch (field.fieldId) { 198 case 1: { 199 if (field.typeId == TType.I32) { 200 int value = protocol.readI32(); 201 builder.height(value); 202 } else { 203 ProtocolUtil.skip(protocol, field.typeId); 204 } 205 } 206 break; 207 case 2: { 208 if (field.typeId == TType.I32) { 209 int value = protocol.readI32(); 210 builder.left(value); 211 } else { 212 ProtocolUtil.skip(protocol, field.typeId); 213 } 214 } 215 break; 216 case 3: { 217 if (field.typeId == TType.I32) { 218 int value = protocol.readI32(); 219 builder.top(value); 220 } else { 221 ProtocolUtil.skip(protocol, field.typeId); 222 } 223 } 224 break; 225 case 4: { 226 if (field.typeId == TType.I32) { 227 int value = protocol.readI32(); 228 builder.width(value); 229 } else { 230 ProtocolUtil.skip(protocol, field.typeId); 231 } 232 } 233 break; 234 default: { 235 ProtocolUtil.skip(protocol, field.typeId); 236 } 237 break; 238 } 239 protocol.readFieldEnd(); 240 } 241 protocol.readStructEnd(); 242 return builder.build(); 243 } 244 245 @Override 246 public FRect read(Protocol protocol) throws IOException { 247 return read(protocol, new Builder()); 248 } 249 } 250}