001// Automatically generated by the Thrifty compiler; do not edit! 002// Generated on: 2021-05-17T06:20:27.415Z 003// Source: J:\facedb\facedb-service\FaceDb.thrift at 25: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 FInt2 implements Struct { 022 public static final Adapter<FInt2, Builder> ADAPTER = new FInt2Adapter(); 023 024 @ThriftField( 025 fieldId = 1, 026 isRequired = true 027 ) 028 public final Integer x; 029 030 @ThriftField( 031 fieldId = 2, 032 isRequired = true 033 ) 034 public final Integer y; 035 036 private FInt2(Builder builder) { 037 this.x = builder.x; 038 this.y = builder.y; 039 } 040 041 @Override 042 @SuppressWarnings("NumberEquality") 043 public boolean equals(Object other) { 044 if (this == other) return true; 045 if (other == null) return false; 046 if (!(other instanceof FInt2)) return false; 047 FInt2 that = (FInt2) other; 048 return (this.x == that.x || this.x.equals(that.x)) 049 && (this.y == that.y || this.y.equals(that.y)); 050 } 051 052 @Override 053 public int hashCode() { 054 int code = 16777619; 055 code ^= this.x.hashCode(); 056 code *= 0x811c9dc5; 057 code ^= this.y.hashCode(); 058 code *= 0x811c9dc5; 059 return code; 060 } 061 062 @Override 063 public String toString() { 064 return "FInt2{x=" + this.x + ", y=" + this.y + "}"; 065 } 066 067 @Override 068 public void write(Protocol protocol) throws IOException { 069 ADAPTER.write(protocol, this); 070 } 071 072 public static final class Builder implements StructBuilder<FInt2> { 073 private Integer x; 074 075 private Integer y; 076 077 public Builder() { 078 } 079 080 public Builder(FInt2 struct) { 081 this.x = struct.x; 082 this.y = struct.y; 083 } 084 085 public Builder x(Integer x) { 086 if (x == null) { 087 throw new NullPointerException("Required field 'x' cannot be null"); 088 } 089 this.x = x; 090 return this; 091 } 092 093 public Builder y(Integer y) { 094 if (y == null) { 095 throw new NullPointerException("Required field 'y' cannot be null"); 096 } 097 this.y = y; 098 return this; 099 } 100 101 @Override 102 public FInt2 build() { 103 if (this.x == null) { 104 throw new IllegalStateException("Required field 'x' is missing"); 105 } 106 if (this.y == null) { 107 throw new IllegalStateException("Required field 'y' is missing"); 108 } 109 return new FInt2(this); 110 } 111 112 @Override 113 public void reset() { 114 this.x = null; 115 this.y = null; 116 } 117 } 118 119 private static final class FInt2Adapter implements Adapter<FInt2, Builder> { 120 @Override 121 public void write(Protocol protocol, FInt2 struct) throws IOException { 122 protocol.writeStructBegin("FInt2"); 123 protocol.writeFieldBegin("x", 1, TType.I32); 124 protocol.writeI32(struct.x); 125 protocol.writeFieldEnd(); 126 protocol.writeFieldBegin("y", 2, TType.I32); 127 protocol.writeI32(struct.y); 128 protocol.writeFieldEnd(); 129 protocol.writeFieldStop(); 130 protocol.writeStructEnd(); 131 } 132 133 @Override 134 public FInt2 read(Protocol protocol, Builder builder) throws IOException { 135 protocol.readStructBegin(); 136 while (true) { 137 FieldMetadata field = protocol.readFieldBegin(); 138 if (field.typeId == TType.STOP) { 139 break; 140 } 141 switch (field.fieldId) { 142 case 1: { 143 if (field.typeId == TType.I32) { 144 int value = protocol.readI32(); 145 builder.x(value); 146 } else { 147 ProtocolUtil.skip(protocol, field.typeId); 148 } 149 } 150 break; 151 case 2: { 152 if (field.typeId == TType.I32) { 153 int value = protocol.readI32(); 154 builder.y(value); 155 } else { 156 ProtocolUtil.skip(protocol, field.typeId); 157 } 158 } 159 break; 160 default: { 161 ProtocolUtil.skip(protocol, field.typeId); 162 } 163 break; 164 } 165 protocol.readFieldEnd(); 166 } 167 protocol.readStructEnd(); 168 return builder.build(); 169 } 170 171 @Override 172 public FInt2 read(Protocol protocol) throws IOException { 173 return read(protocol, new Builder()); 174 } 175 } 176}