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