001// Automatically generated by the Thrifty compiler; do not edit! 002// Generated on: 2022-01-25T22:54:21.477211Z 003// Source: /Users/benbader/Development/dexcount-gradle-plugin/src/main/thrift/PackageTree.thrift: (10, 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.Protocol; 013import com.microsoft.thrifty.util.ProtocolUtil; 014import java.io.IOException; 015 016public final class FieldRef implements Struct { 017 public static final Adapter<FieldRef, Builder> ADAPTER = new FieldRefAdapter(); 018 019 @ThriftField( 020 fieldId = 1 021 ) 022 public final String declaringClass; 023 024 @ThriftField( 025 fieldId = 2 026 ) 027 public final String fieldType; 028 029 @ThriftField( 030 fieldId = 3 031 ) 032 public final String fieldName; 033 034 private FieldRef(Builder builder) { 035 this.declaringClass = builder.declaringClass; 036 this.fieldType = builder.fieldType; 037 this.fieldName = builder.fieldName; 038 } 039 040 @Override 041 @SuppressWarnings("StringEquality") 042 public boolean equals(Object other) { 043 if (this == other) return true; 044 if (other == null) return false; 045 if (!(other instanceof FieldRef)) return false; 046 FieldRef that = (FieldRef) other; 047 return (this.declaringClass == that.declaringClass || (this.declaringClass != null && this.declaringClass.equals(that.declaringClass))) 048 && (this.fieldType == that.fieldType || (this.fieldType != null && this.fieldType.equals(that.fieldType))) 049 && (this.fieldName == that.fieldName || (this.fieldName != null && this.fieldName.equals(that.fieldName))); 050 } 051 052 @Override 053 public int hashCode() { 054 int code = 16777619; 055 code ^= (this.declaringClass == null) ? 0 : this.declaringClass.hashCode(); 056 code *= 0x811c9dc5; 057 code ^= (this.fieldType == null) ? 0 : this.fieldType.hashCode(); 058 code *= 0x811c9dc5; 059 code ^= (this.fieldName == null) ? 0 : this.fieldName.hashCode(); 060 code *= 0x811c9dc5; 061 return code; 062 } 063 064 @Override 065 public String toString() { 066 return "FieldRef{declaringClass=" + this.declaringClass + ", fieldType=" + this.fieldType + ", fieldName=" + this.fieldName + "}"; 067 } 068 069 @Override 070 public void write(Protocol protocol) throws IOException { 071 ADAPTER.write(protocol, this); 072 } 073 074 public static final class Builder implements StructBuilder<FieldRef> { 075 private String declaringClass; 076 077 private String fieldType; 078 079 private String fieldName; 080 081 public Builder() { 082 } 083 084 public Builder(FieldRef struct) { 085 this.declaringClass = struct.declaringClass; 086 this.fieldType = struct.fieldType; 087 this.fieldName = struct.fieldName; 088 } 089 090 public Builder declaringClass(String declaringClass) { 091 this.declaringClass = declaringClass; 092 return this; 093 } 094 095 public Builder fieldType(String fieldType) { 096 this.fieldType = fieldType; 097 return this; 098 } 099 100 public Builder fieldName(String fieldName) { 101 this.fieldName = fieldName; 102 return this; 103 } 104 105 @Override 106 public FieldRef build() { 107 return new FieldRef(this); 108 } 109 110 @Override 111 public void reset() { 112 this.declaringClass = null; 113 this.fieldType = null; 114 this.fieldName = null; 115 } 116 } 117 118 private static final class FieldRefAdapter implements Adapter<FieldRef, Builder> { 119 @Override 120 public void write(Protocol protocol, FieldRef struct) throws IOException { 121 protocol.writeStructBegin("FieldRef"); 122 if (struct.declaringClass != null) { 123 protocol.writeFieldBegin("declaringClass", 1, TType.STRING); 124 protocol.writeString(struct.declaringClass); 125 protocol.writeFieldEnd(); 126 } 127 if (struct.fieldType != null) { 128 protocol.writeFieldBegin("fieldType", 2, TType.STRING); 129 protocol.writeString(struct.fieldType); 130 protocol.writeFieldEnd(); 131 } 132 if (struct.fieldName != null) { 133 protocol.writeFieldBegin("fieldName", 3, TType.STRING); 134 protocol.writeString(struct.fieldName); 135 protocol.writeFieldEnd(); 136 } 137 protocol.writeFieldStop(); 138 protocol.writeStructEnd(); 139 } 140 141 @Override 142 public FieldRef read(Protocol protocol, Builder builder) throws IOException { 143 protocol.readStructBegin(); 144 while (true) { 145 FieldMetadata field = protocol.readFieldBegin(); 146 if (field.typeId == TType.STOP) { 147 break; 148 } 149 switch (field.fieldId) { 150 case 1: { 151 if (field.typeId == TType.STRING) { 152 String value = protocol.readString(); 153 builder.declaringClass(value); 154 } else { 155 ProtocolUtil.skip(protocol, field.typeId); 156 } 157 } 158 break; 159 case 2: { 160 if (field.typeId == TType.STRING) { 161 String value = protocol.readString(); 162 builder.fieldType(value); 163 } else { 164 ProtocolUtil.skip(protocol, field.typeId); 165 } 166 } 167 break; 168 case 3: { 169 if (field.typeId == TType.STRING) { 170 String value = protocol.readString(); 171 builder.fieldName(value); 172 } else { 173 ProtocolUtil.skip(protocol, field.typeId); 174 } 175 } 176 break; 177 default: { 178 ProtocolUtil.skip(protocol, field.typeId); 179 } 180 break; 181 } 182 protocol.readFieldEnd(); 183 } 184 protocol.readStructEnd(); 185 return builder.build(); 186 } 187 188 @Override 189 public FieldRef read(Protocol protocol) throws IOException { 190 return read(protocol, new Builder()); 191 } 192 } 193}