001// Automatically generated by the Thrifty compiler; do not edit! 002// Generated on: 2022-01-25T22:54:21.479506Z 003// Source: /Users/benbader/Development/dexcount-gradle-plugin/src/main/thrift/PackageTree.thrift: (16, 1) 004package com.getkeepsafe.dexcount.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.protocol.SetMetadata; 015import com.microsoft.thrifty.util.ProtocolUtil; 016import java.io.IOException; 017import java.util.Collections; 018import java.util.HashMap; 019import java.util.HashSet; 020import java.util.Map; 021import java.util.Set; 022 023public final class PackageTree implements Struct { 024 public static final Adapter<PackageTree, Builder> ADAPTER = new PackageTreeAdapter(); 025 026 @ThriftField( 027 fieldId = 1 028 ) 029 public final String name; 030 031 @ThriftField( 032 fieldId = 2 033 ) 034 public final Boolean isClass; 035 036 @ThriftField( 037 fieldId = 3 038 ) 039 public final Map<String, PackageTree> children; 040 041 @ThriftField( 042 fieldId = 4 043 ) 044 public final Set<MethodRef> declaredMethods; 045 046 @ThriftField( 047 fieldId = 5 048 ) 049 public final Set<MethodRef> referencedMethods; 050 051 @ThriftField( 052 fieldId = 6 053 ) 054 public final Set<FieldRef> declaredFields; 055 056 @ThriftField( 057 fieldId = 7 058 ) 059 public final Set<FieldRef> referencedFields; 060 061 private PackageTree(Builder builder) { 062 this.name = builder.name; 063 this.isClass = builder.isClass; 064 this.children = builder.children == null ? null : Collections.unmodifiableMap(builder.children); 065 this.declaredMethods = builder.declaredMethods == null ? null : Collections.unmodifiableSet(builder.declaredMethods); 066 this.referencedMethods = builder.referencedMethods == null ? null : Collections.unmodifiableSet(builder.referencedMethods); 067 this.declaredFields = builder.declaredFields == null ? null : Collections.unmodifiableSet(builder.declaredFields); 068 this.referencedFields = builder.referencedFields == null ? null : Collections.unmodifiableSet(builder.referencedFields); 069 } 070 071 @Override 072 @SuppressWarnings("StringEquality") 073 public boolean equals(Object other) { 074 if (this == other) return true; 075 if (other == null) return false; 076 if (!(other instanceof PackageTree)) return false; 077 PackageTree that = (PackageTree) other; 078 return (this.name == that.name || (this.name != null && this.name.equals(that.name))) 079 && (this.isClass == that.isClass || (this.isClass != null && this.isClass.equals(that.isClass))) 080 && (this.children == that.children || (this.children != null && this.children.equals(that.children))) 081 && (this.declaredMethods == that.declaredMethods || (this.declaredMethods != null && this.declaredMethods.equals(that.declaredMethods))) 082 && (this.referencedMethods == that.referencedMethods || (this.referencedMethods != null && this.referencedMethods.equals(that.referencedMethods))) 083 && (this.declaredFields == that.declaredFields || (this.declaredFields != null && this.declaredFields.equals(that.declaredFields))) 084 && (this.referencedFields == that.referencedFields || (this.referencedFields != null && this.referencedFields.equals(that.referencedFields))); 085 } 086 087 @Override 088 public int hashCode() { 089 int code = 16777619; 090 code ^= (this.name == null) ? 0 : this.name.hashCode(); 091 code *= 0x811c9dc5; 092 code ^= (this.isClass == null) ? 0 : this.isClass.hashCode(); 093 code *= 0x811c9dc5; 094 code ^= (this.children == null) ? 0 : this.children.hashCode(); 095 code *= 0x811c9dc5; 096 code ^= (this.declaredMethods == null) ? 0 : this.declaredMethods.hashCode(); 097 code *= 0x811c9dc5; 098 code ^= (this.referencedMethods == null) ? 0 : this.referencedMethods.hashCode(); 099 code *= 0x811c9dc5; 100 code ^= (this.declaredFields == null) ? 0 : this.declaredFields.hashCode(); 101 code *= 0x811c9dc5; 102 code ^= (this.referencedFields == null) ? 0 : this.referencedFields.hashCode(); 103 code *= 0x811c9dc5; 104 return code; 105 } 106 107 @Override 108 public String toString() { 109 return "PackageTree{name=" + this.name + ", isClass=" + this.isClass + ", children=" + this.children + ", declaredMethods=" + this.declaredMethods + ", referencedMethods=" + this.referencedMethods + ", declaredFields=" + this.declaredFields + ", referencedFields=" + this.referencedFields + "}"; 110 } 111 112 @Override 113 public void write(Protocol protocol) throws IOException { 114 ADAPTER.write(protocol, this); 115 } 116 117 public static final class Builder implements StructBuilder<PackageTree> { 118 private String name; 119 120 private Boolean isClass; 121 122 private Map<String, PackageTree> children; 123 124 private Set<MethodRef> declaredMethods; 125 126 private Set<MethodRef> referencedMethods; 127 128 private Set<FieldRef> declaredFields; 129 130 private Set<FieldRef> referencedFields; 131 132 public Builder() { 133 } 134 135 public Builder(PackageTree struct) { 136 this.name = struct.name; 137 this.isClass = struct.isClass; 138 this.children = struct.children; 139 this.declaredMethods = struct.declaredMethods; 140 this.referencedMethods = struct.referencedMethods; 141 this.declaredFields = struct.declaredFields; 142 this.referencedFields = struct.referencedFields; 143 } 144 145 public Builder name(String name) { 146 this.name = name; 147 return this; 148 } 149 150 public Builder isClass(Boolean isClass) { 151 this.isClass = isClass; 152 return this; 153 } 154 155 public Builder children(Map<String, PackageTree> children) { 156 this.children = children; 157 return this; 158 } 159 160 public Builder declaredMethods(Set<MethodRef> declaredMethods) { 161 this.declaredMethods = declaredMethods; 162 return this; 163 } 164 165 public Builder referencedMethods(Set<MethodRef> referencedMethods) { 166 this.referencedMethods = referencedMethods; 167 return this; 168 } 169 170 public Builder declaredFields(Set<FieldRef> declaredFields) { 171 this.declaredFields = declaredFields; 172 return this; 173 } 174 175 public Builder referencedFields(Set<FieldRef> referencedFields) { 176 this.referencedFields = referencedFields; 177 return this; 178 } 179 180 @Override 181 public PackageTree build() { 182 return new PackageTree(this); 183 } 184 185 @Override 186 public void reset() { 187 this.name = null; 188 this.isClass = null; 189 this.children = null; 190 this.declaredMethods = null; 191 this.referencedMethods = null; 192 this.declaredFields = null; 193 this.referencedFields = null; 194 } 195 } 196 197 private static final class PackageTreeAdapter implements Adapter<PackageTree, Builder> { 198 @Override 199 public void write(Protocol protocol, PackageTree struct) throws IOException { 200 protocol.writeStructBegin("PackageTree"); 201 if (struct.name != null) { 202 protocol.writeFieldBegin("name", 1, TType.STRING); 203 protocol.writeString(struct.name); 204 protocol.writeFieldEnd(); 205 } 206 if (struct.isClass != null) { 207 protocol.writeFieldBegin("isClass", 2, TType.BOOL); 208 protocol.writeBool(struct.isClass); 209 protocol.writeFieldEnd(); 210 } 211 if (struct.children != null) { 212 protocol.writeFieldBegin("children", 3, TType.MAP); 213 protocol.writeMapBegin(TType.STRING, TType.STRUCT, struct.children.size()); 214 for (Map.Entry<String, PackageTree> entry0 : struct.children.entrySet()) { 215 String key0 = entry0.getKey(); 216 PackageTree value0 = entry0.getValue(); 217 protocol.writeString(key0); 218 com.getkeepsafe.dexcount.thrift.PackageTree.ADAPTER.write(protocol, value0); 219 } 220 protocol.writeMapEnd(); 221 protocol.writeFieldEnd(); 222 } 223 if (struct.declaredMethods != null) { 224 protocol.writeFieldBegin("declaredMethods", 4, TType.SET); 225 protocol.writeSetBegin(TType.STRUCT, struct.declaredMethods.size()); 226 for (MethodRef item0 : struct.declaredMethods) { 227 com.getkeepsafe.dexcount.thrift.MethodRef.ADAPTER.write(protocol, item0); 228 } 229 protocol.writeSetEnd(); 230 protocol.writeFieldEnd(); 231 } 232 if (struct.referencedMethods != null) { 233 protocol.writeFieldBegin("referencedMethods", 5, TType.SET); 234 protocol.writeSetBegin(TType.STRUCT, struct.referencedMethods.size()); 235 for (MethodRef item0 : struct.referencedMethods) { 236 com.getkeepsafe.dexcount.thrift.MethodRef.ADAPTER.write(protocol, item0); 237 } 238 protocol.writeSetEnd(); 239 protocol.writeFieldEnd(); 240 } 241 if (struct.declaredFields != null) { 242 protocol.writeFieldBegin("declaredFields", 6, TType.SET); 243 protocol.writeSetBegin(TType.STRUCT, struct.declaredFields.size()); 244 for (FieldRef item0 : struct.declaredFields) { 245 com.getkeepsafe.dexcount.thrift.FieldRef.ADAPTER.write(protocol, item0); 246 } 247 protocol.writeSetEnd(); 248 protocol.writeFieldEnd(); 249 } 250 if (struct.referencedFields != null) { 251 protocol.writeFieldBegin("referencedFields", 7, TType.SET); 252 protocol.writeSetBegin(TType.STRUCT, struct.referencedFields.size()); 253 for (FieldRef item0 : struct.referencedFields) { 254 com.getkeepsafe.dexcount.thrift.FieldRef.ADAPTER.write(protocol, item0); 255 } 256 protocol.writeSetEnd(); 257 protocol.writeFieldEnd(); 258 } 259 protocol.writeFieldStop(); 260 protocol.writeStructEnd(); 261 } 262 263 @Override 264 public PackageTree read(Protocol protocol, Builder builder) throws IOException { 265 protocol.readStructBegin(); 266 while (true) { 267 FieldMetadata field = protocol.readFieldBegin(); 268 if (field.typeId == TType.STOP) { 269 break; 270 } 271 switch (field.fieldId) { 272 case 1: { 273 if (field.typeId == TType.STRING) { 274 String value = protocol.readString(); 275 builder.name(value); 276 } else { 277 ProtocolUtil.skip(protocol, field.typeId); 278 } 279 } 280 break; 281 case 2: { 282 if (field.typeId == TType.BOOL) { 283 boolean value = protocol.readBool(); 284 builder.isClass(value); 285 } else { 286 ProtocolUtil.skip(protocol, field.typeId); 287 } 288 } 289 break; 290 case 3: { 291 if (field.typeId == TType.MAP) { 292 MapMetadata mapMetadata0 = protocol.readMapBegin(); 293 Map<String, PackageTree> value = new HashMap<String, PackageTree>(mapMetadata0.size); 294 for (int i0 = 0; i0 < mapMetadata0.size; ++i0) { 295 String key0 = protocol.readString(); 296 com.getkeepsafe.dexcount.thrift.PackageTree value0 = com.getkeepsafe.dexcount.thrift.PackageTree.ADAPTER.read(protocol); 297 value.put(key0, value0); 298 } 299 protocol.readMapEnd(); 300 builder.children(value); 301 } else { 302 ProtocolUtil.skip(protocol, field.typeId); 303 } 304 } 305 break; 306 case 4: { 307 if (field.typeId == TType.SET) { 308 SetMetadata setMetadata0 = protocol.readSetBegin(); 309 Set<MethodRef> value = new HashSet<MethodRef>(setMetadata0.size); 310 for (int i0 = 0; i0 < setMetadata0.size; ++i0) { 311 com.getkeepsafe.dexcount.thrift.MethodRef item0 = com.getkeepsafe.dexcount.thrift.MethodRef.ADAPTER.read(protocol); 312 value.add(item0); 313 } 314 protocol.readSetEnd(); 315 builder.declaredMethods(value); 316 } else { 317 ProtocolUtil.skip(protocol, field.typeId); 318 } 319 } 320 break; 321 case 5: { 322 if (field.typeId == TType.SET) { 323 SetMetadata setMetadata0 = protocol.readSetBegin(); 324 Set<MethodRef> value = new HashSet<MethodRef>(setMetadata0.size); 325 for (int i0 = 0; i0 < setMetadata0.size; ++i0) { 326 com.getkeepsafe.dexcount.thrift.MethodRef item0 = com.getkeepsafe.dexcount.thrift.MethodRef.ADAPTER.read(protocol); 327 value.add(item0); 328 } 329 protocol.readSetEnd(); 330 builder.referencedMethods(value); 331 } else { 332 ProtocolUtil.skip(protocol, field.typeId); 333 } 334 } 335 break; 336 case 6: { 337 if (field.typeId == TType.SET) { 338 SetMetadata setMetadata0 = protocol.readSetBegin(); 339 Set<FieldRef> value = new HashSet<FieldRef>(setMetadata0.size); 340 for (int i0 = 0; i0 < setMetadata0.size; ++i0) { 341 com.getkeepsafe.dexcount.thrift.FieldRef item0 = com.getkeepsafe.dexcount.thrift.FieldRef.ADAPTER.read(protocol); 342 value.add(item0); 343 } 344 protocol.readSetEnd(); 345 builder.declaredFields(value); 346 } else { 347 ProtocolUtil.skip(protocol, field.typeId); 348 } 349 } 350 break; 351 case 7: { 352 if (field.typeId == TType.SET) { 353 SetMetadata setMetadata0 = protocol.readSetBegin(); 354 Set<FieldRef> value = new HashSet<FieldRef>(setMetadata0.size); 355 for (int i0 = 0; i0 < setMetadata0.size; ++i0) { 356 com.getkeepsafe.dexcount.thrift.FieldRef item0 = com.getkeepsafe.dexcount.thrift.FieldRef.ADAPTER.read(protocol); 357 value.add(item0); 358 } 359 protocol.readSetEnd(); 360 builder.referencedFields(value); 361 } else { 362 ProtocolUtil.skip(protocol, field.typeId); 363 } 364 } 365 break; 366 default: { 367 ProtocolUtil.skip(protocol, field.typeId); 368 } 369 break; 370 } 371 protocol.readFieldEnd(); 372 } 373 protocol.readStructEnd(); 374 return builder.build(); 375 } 376 377 @Override 378 public PackageTree read(Protocol protocol) throws IOException { 379 return read(protocol, new Builder()); 380 } 381 } 382}