001// Automatically generated by the Thrifty compiler; do not edit! 002// Generated on: 2020-11-05T09:22:38.123Z 003// Source: J:\facelog\facelog-service\IFaceLog.thrift at 225: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.MapMetadata; 013import com.microsoft.thrifty.protocol.Protocol; 014import com.microsoft.thrifty.util.ProtocolUtil; 015import java.io.IOException; 016import java.util.Collections; 017import java.util.HashMap; 018import java.util.Map; 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 TopGroupInfo implements Struct { 026 public static final Adapter<TopGroupInfo, Builder> ADAPTER = new TopGroupInfoAdapter(); 027 028 @ThriftField( 029 fieldId = 1, 030 isRequired = true 031 ) 032 public final Boolean clearMore; 033 034 @ThriftField( 035 fieldId = 2, 036 isOptional = true 037 ) 038 public final String name; 039 040 @ThriftField( 041 fieldId = 3, 042 isOptional = true 043 ) 044 public final Map<String, String> nodes; 045 046 @ThriftField( 047 fieldId = 4, 048 isOptional = true 049 ) 050 public final Map<String, String> permits; 051 052 private TopGroupInfo(Builder builder) { 053 this.clearMore = builder.clearMore; 054 this.name = builder.name; 055 this.nodes = builder.nodes == null ? null : Collections.unmodifiableMap(builder.nodes); 056 this.permits = builder.permits == null ? null : Collections.unmodifiableMap(builder.permits); 057 } 058 059 @Override 060 @SuppressWarnings("StringEquality") 061 public boolean equals(Object other) { 062 if (this == other) return true; 063 if (other == null) return false; 064 if (!(other instanceof TopGroupInfo)) return false; 065 TopGroupInfo that = (TopGroupInfo) other; 066 return (this.clearMore == that.clearMore || this.clearMore.equals(that.clearMore)) 067 && (this.name == that.name || (this.name != null && this.name.equals(that.name))) 068 && (this.nodes == that.nodes || (this.nodes != null && this.nodes.equals(that.nodes))) 069 && (this.permits == that.permits || (this.permits != null && this.permits.equals(that.permits))); 070 } 071 072 @Override 073 public int hashCode() { 074 int code = 16777619; 075 code ^= this.clearMore.hashCode(); 076 code *= 0x811c9dc5; 077 code ^= (this.name == null) ? 0 : this.name.hashCode(); 078 code *= 0x811c9dc5; 079 code ^= (this.nodes == null) ? 0 : this.nodes.hashCode(); 080 code *= 0x811c9dc5; 081 code ^= (this.permits == null) ? 0 : this.permits.hashCode(); 082 code *= 0x811c9dc5; 083 return code; 084 } 085 086 @Override 087 public String toString() { 088 return "TopGroupInfo{clearMore=" + this.clearMore + ", name=" + this.name + ", nodes=" + this.nodes + ", permits=" + this.permits + "}"; 089 } 090 091 @Override 092 public void write(Protocol protocol) throws IOException { 093 ADAPTER.write(protocol, this); 094 } 095 096 public static final class Builder implements StructBuilder<TopGroupInfo> { 097 private Boolean clearMore; 098 099 private String name; 100 101 private Map<String, String> nodes; 102 103 private Map<String, String> permits; 104 105 public Builder() { 106 } 107 108 public Builder(TopGroupInfo struct) { 109 this.clearMore = struct.clearMore; 110 this.name = struct.name; 111 this.nodes = struct.nodes; 112 this.permits = struct.permits; 113 } 114 115 public Builder clearMore(Boolean clearMore) { 116 if (clearMore == null) { 117 throw new NullPointerException("Required field 'clearMore' cannot be null"); 118 } 119 this.clearMore = clearMore; 120 return this; 121 } 122 123 public Builder name(String name) { 124 this.name = name; 125 return this; 126 } 127 128 public Builder nodes(Map<String, String> nodes) { 129 this.nodes = nodes; 130 return this; 131 } 132 133 public Builder permits(Map<String, String> permits) { 134 this.permits = permits; 135 return this; 136 } 137 138 @Override 139 public TopGroupInfo build() { 140 if (this.clearMore == null) { 141 throw new IllegalStateException("Required field 'clearMore' is missing"); 142 } 143 return new TopGroupInfo(this); 144 } 145 146 @Override 147 public void reset() { 148 this.clearMore = null; 149 this.name = null; 150 this.nodes = null; 151 this.permits = null; 152 } 153 } 154 155 private static final class TopGroupInfoAdapter implements Adapter<TopGroupInfo, Builder> { 156 @Override 157 public void write(Protocol protocol, TopGroupInfo struct) throws IOException { 158 protocol.writeStructBegin("TopGroupInfo"); 159 protocol.writeFieldBegin("clearMore", 1, TType.BOOL); 160 protocol.writeBool(struct.clearMore); 161 protocol.writeFieldEnd(); 162 if (struct.name != null) { 163 protocol.writeFieldBegin("name", 2, TType.STRING); 164 protocol.writeString(struct.name); 165 protocol.writeFieldEnd(); 166 } 167 if (struct.nodes != null) { 168 protocol.writeFieldBegin("nodes", 3, TType.MAP); 169 protocol.writeMapBegin(TType.STRING, TType.STRING, struct.nodes.size()); 170 for (Map.Entry<String, String> entry0 : struct.nodes.entrySet()) { 171 String key0 = entry0.getKey(); 172 String value0 = entry0.getValue(); 173 protocol.writeString(key0); 174 protocol.writeString(value0); 175 } 176 protocol.writeMapEnd(); 177 protocol.writeFieldEnd(); 178 } 179 if (struct.permits != null) { 180 protocol.writeFieldBegin("permits", 4, TType.MAP); 181 protocol.writeMapBegin(TType.STRING, TType.STRING, struct.permits.size()); 182 for (Map.Entry<String, String> entry0 : struct.permits.entrySet()) { 183 String key0 = entry0.getKey(); 184 String value0 = entry0.getValue(); 185 protocol.writeString(key0); 186 protocol.writeString(value0); 187 } 188 protocol.writeMapEnd(); 189 protocol.writeFieldEnd(); 190 } 191 protocol.writeFieldStop(); 192 protocol.writeStructEnd(); 193 } 194 195 @Override 196 public TopGroupInfo read(Protocol protocol, Builder builder) throws IOException { 197 protocol.readStructBegin(); 198 while (true) { 199 FieldMetadata field = protocol.readFieldBegin(); 200 if (field.typeId == TType.STOP) { 201 break; 202 } 203 switch (field.fieldId) { 204 case 1: { 205 if (field.typeId == TType.BOOL) { 206 boolean value = protocol.readBool(); 207 builder.clearMore(value); 208 } else { 209 ProtocolUtil.skip(protocol, field.typeId); 210 } 211 } 212 break; 213 case 2: { 214 if (field.typeId == TType.STRING) { 215 String value = protocol.readString(); 216 builder.name(value); 217 } else { 218 ProtocolUtil.skip(protocol, field.typeId); 219 } 220 } 221 break; 222 case 3: { 223 if (field.typeId == TType.MAP) { 224 MapMetadata mapMetadata0 = protocol.readMapBegin(); 225 Map<String, String> value = new HashMap<String, String>(mapMetadata0.size); 226 for (int i0 = 0; i0 < mapMetadata0.size; ++i0) { 227 String key0 = protocol.readString(); 228 String value0 = protocol.readString(); 229 value.put(key0, value0); 230 } 231 protocol.readMapEnd(); 232 builder.nodes(value); 233 } else { 234 ProtocolUtil.skip(protocol, field.typeId); 235 } 236 } 237 break; 238 case 4: { 239 if (field.typeId == TType.MAP) { 240 MapMetadata mapMetadata0 = protocol.readMapBegin(); 241 Map<String, String> value = new HashMap<String, String>(mapMetadata0.size); 242 for (int i0 = 0; i0 < mapMetadata0.size; ++i0) { 243 String key0 = protocol.readString(); 244 String value0 = protocol.readString(); 245 value.put(key0, value0); 246 } 247 protocol.readMapEnd(); 248 builder.permits(value); 249 } else { 250 ProtocolUtil.skip(protocol, field.typeId); 251 } 252 } 253 break; 254 default: { 255 ProtocolUtil.skip(protocol, field.typeId); 256 } 257 break; 258 } 259 protocol.readFieldEnd(); 260 } 261 protocol.readStructEnd(); 262 return builder.build(); 263 } 264 265 @Override 266 public TopGroupInfo read(Protocol protocol) throws IOException { 267 return read(protocol, new Builder()); 268 } 269 } 270}