001// Automatically generated by the Thrifty compiler; do not edit! 002// Generated on: 2020-11-05T09:22:38.122Z 003// Source: J:\facelog\facelog-service\IFaceLog.thrift at 219:1 004package net.gdface.facelog.client.thrift; 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.ThriftException; 011import com.microsoft.thrifty.ThriftField; 012import com.microsoft.thrifty.protocol.FieldMetadata; 013import com.microsoft.thrifty.protocol.Protocol; 014import com.microsoft.thrifty.util.ProtocolUtil; 015import java.io.IOException; 016import javax.annotation.Generated; 017 018@Generated( 019 value = "com.microsoft.thrifty.gen.ThriftyCodeGenerator", 020 comments = "https://github.com/microsoft/thrifty" 021) 022public final class TmpwdTargetInfo implements Struct { 023 public static final Adapter<TmpwdTargetInfo, Builder> ADAPTER = new TmpwdTargetInfoAdapter(); 024 025 @ThriftField( 026 fieldId = 1, 027 isOptional = true 028 ) 029 public final Long expiryDate; 030 031 @ThriftField( 032 fieldId = 2, 033 isRequired = true 034 ) 035 public final Integer targetId; 036 037 @ThriftField( 038 fieldId = 3, 039 isOptional = true 040 ) 041 public final TmpPwdTargetType targetType; 042 043 private TmpwdTargetInfo(Builder builder) { 044 this.expiryDate = builder.expiryDate; 045 this.targetId = builder.targetId; 046 this.targetType = builder.targetType; 047 } 048 049 @Override 050 @SuppressWarnings("NumberEquality") 051 public boolean equals(Object other) { 052 if (this == other) return true; 053 if (other == null) return false; 054 if (!(other instanceof TmpwdTargetInfo)) return false; 055 TmpwdTargetInfo that = (TmpwdTargetInfo) other; 056 return (this.expiryDate == that.expiryDate || (this.expiryDate != null && this.expiryDate.equals(that.expiryDate))) 057 && (this.targetId == that.targetId || this.targetId.equals(that.targetId)) 058 && (this.targetType == that.targetType || (this.targetType != null && this.targetType.equals(that.targetType))); 059 } 060 061 @Override 062 public int hashCode() { 063 int code = 16777619; 064 code ^= (this.expiryDate == null) ? 0 : this.expiryDate.hashCode(); 065 code *= 0x811c9dc5; 066 code ^= this.targetId.hashCode(); 067 code *= 0x811c9dc5; 068 code ^= (this.targetType == null) ? 0 : this.targetType.hashCode(); 069 code *= 0x811c9dc5; 070 return code; 071 } 072 073 @Override 074 public String toString() { 075 return "TmpwdTargetInfo{expiryDate=" + this.expiryDate + ", targetId=" + this.targetId + ", targetType=" + this.targetType + "}"; 076 } 077 078 @Override 079 public void write(Protocol protocol) throws IOException { 080 ADAPTER.write(protocol, this); 081 } 082 083 public static final class Builder implements StructBuilder<TmpwdTargetInfo> { 084 private Long expiryDate; 085 086 private Integer targetId; 087 088 private TmpPwdTargetType targetType; 089 090 public Builder() { 091 } 092 093 public Builder(TmpwdTargetInfo struct) { 094 this.expiryDate = struct.expiryDate; 095 this.targetId = struct.targetId; 096 this.targetType = struct.targetType; 097 } 098 099 public Builder expiryDate(Long expiryDate) { 100 this.expiryDate = expiryDate; 101 return this; 102 } 103 104 public Builder targetId(Integer targetId) { 105 if (targetId == null) { 106 throw new NullPointerException("Required field 'targetId' cannot be null"); 107 } 108 this.targetId = targetId; 109 return this; 110 } 111 112 public Builder targetType(TmpPwdTargetType targetType) { 113 this.targetType = targetType; 114 return this; 115 } 116 117 @Override 118 public TmpwdTargetInfo build() { 119 if (this.targetId == null) { 120 throw new IllegalStateException("Required field 'targetId' is missing"); 121 } 122 return new TmpwdTargetInfo(this); 123 } 124 125 @Override 126 public void reset() { 127 this.expiryDate = null; 128 this.targetId = null; 129 this.targetType = null; 130 } 131 } 132 133 private static final class TmpwdTargetInfoAdapter implements Adapter<TmpwdTargetInfo, Builder> { 134 @Override 135 public void write(Protocol protocol, TmpwdTargetInfo struct) throws IOException { 136 protocol.writeStructBegin("TmpwdTargetInfo"); 137 if (struct.expiryDate != null) { 138 protocol.writeFieldBegin("expiryDate", 1, TType.I64); 139 protocol.writeI64(struct.expiryDate); 140 protocol.writeFieldEnd(); 141 } 142 protocol.writeFieldBegin("targetId", 2, TType.I32); 143 protocol.writeI32(struct.targetId); 144 protocol.writeFieldEnd(); 145 if (struct.targetType != null) { 146 protocol.writeFieldBegin("targetType", 3, TType.I32); 147 protocol.writeI32(struct.targetType.value); 148 protocol.writeFieldEnd(); 149 } 150 protocol.writeFieldStop(); 151 protocol.writeStructEnd(); 152 } 153 154 @Override 155 public TmpwdTargetInfo read(Protocol protocol, Builder builder) throws IOException { 156 protocol.readStructBegin(); 157 while (true) { 158 FieldMetadata field = protocol.readFieldBegin(); 159 if (field.typeId == TType.STOP) { 160 break; 161 } 162 switch (field.fieldId) { 163 case 1: { 164 if (field.typeId == TType.I64) { 165 long value = protocol.readI64(); 166 builder.expiryDate(value); 167 } else { 168 ProtocolUtil.skip(protocol, field.typeId); 169 } 170 } 171 break; 172 case 2: { 173 if (field.typeId == TType.I32) { 174 int value = protocol.readI32(); 175 builder.targetId(value); 176 } else { 177 ProtocolUtil.skip(protocol, field.typeId); 178 } 179 } 180 break; 181 case 3: { 182 if (field.typeId == TType.I32) { 183 int i32_0 = protocol.readI32(); 184 net.gdface.facelog.client.thrift.TmpPwdTargetType value = net.gdface.facelog.client.thrift.TmpPwdTargetType.findByValue(i32_0); 185 if (value == null) { 186 throw new ThriftException(ThriftException.Kind.PROTOCOL_ERROR, "Unexpected value for enum-type TmpPwdTargetType: " + i32_0); 187 } 188 builder.targetType(value); 189 } else { 190 ProtocolUtil.skip(protocol, field.typeId); 191 } 192 } 193 break; 194 default: { 195 ProtocolUtil.skip(protocol, field.typeId); 196 } 197 break; 198 } 199 protocol.readFieldEnd(); 200 } 201 protocol.readStructEnd(); 202 return builder.build(); 203 } 204 205 @Override 206 public TmpwdTargetInfo read(Protocol protocol) throws IOException { 207 return read(protocol, new Builder()); 208 } 209 } 210}