001// Automatically generated by the Thrifty compiler; do not edit!
002// Generated on: 2023-01-16T22:12:20.367352845Z
003// Source: /home/ben/Development/ks-dexcount/src/main/thrift/PackageTree.thrift: (26, 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 TreeGenOutput implements Struct {
017  public static final Adapter<TreeGenOutput, Builder> ADAPTER = new TreeGenOutputAdapter();
018
019  @ThriftField(
020      fieldId = 1
021  )
022  public final PackageTree tree;
023
024  @ThriftField(
025      fieldId = 2
026  )
027  public final String inputRepresentation;
028
029  private TreeGenOutput(Builder builder) {
030    this.tree = builder.tree;
031    this.inputRepresentation = builder.inputRepresentation;
032  }
033
034  @Override
035  @SuppressWarnings("StringEquality")
036  public boolean equals(Object other) {
037    if (this == other) return true;
038    if (other == null) return false;
039    if (!(other instanceof TreeGenOutput)) return false;
040    TreeGenOutput that = (TreeGenOutput) other;
041    return (this.tree == that.tree || (this.tree != null && this.tree.equals(that.tree)))
042        && (this.inputRepresentation == that.inputRepresentation || (this.inputRepresentation != null && this.inputRepresentation.equals(that.inputRepresentation)));
043  }
044
045  @Override
046  public int hashCode() {
047    int code = 16777619;
048    code ^= (this.tree == null) ? 0 : this.tree.hashCode();
049    code *= 0x811c9dc5;
050    code ^= (this.inputRepresentation == null) ? 0 : this.inputRepresentation.hashCode();
051    code *= 0x811c9dc5;
052    return code;
053  }
054
055  @Override
056  public String toString() {
057    return "TreeGenOutput{tree=" + this.tree + ", inputRepresentation=" + this.inputRepresentation + "}";
058  }
059
060  @Override
061  public void write(Protocol protocol) throws IOException {
062    ADAPTER.write(protocol, this);
063  }
064
065  public static final class Builder implements StructBuilder<TreeGenOutput> {
066    private PackageTree tree;
067
068    private String inputRepresentation;
069
070    public Builder() {
071    }
072
073    public Builder(TreeGenOutput struct) {
074      this.tree = struct.tree;
075      this.inputRepresentation = struct.inputRepresentation;
076    }
077
078    public Builder tree(PackageTree tree) {
079      this.tree = tree;
080      return this;
081    }
082
083    public Builder inputRepresentation(String inputRepresentation) {
084      this.inputRepresentation = inputRepresentation;
085      return this;
086    }
087
088    @Override
089    public TreeGenOutput build() {
090      return new TreeGenOutput(this);
091    }
092
093    @Override
094    public void reset() {
095      this.tree = null;
096      this.inputRepresentation = null;
097    }
098  }
099
100  private static final class TreeGenOutputAdapter implements Adapter<TreeGenOutput, Builder> {
101    @Override
102    public void write(Protocol protocol, TreeGenOutput struct) throws IOException {
103      protocol.writeStructBegin("TreeGenOutput");
104      if (struct.tree != null) {
105        protocol.writeFieldBegin("tree", 1, TType.STRUCT);
106        com.getkeepsafe.dexcount.thrift.PackageTree.ADAPTER.write(protocol, struct.tree);
107        protocol.writeFieldEnd();
108      }
109      if (struct.inputRepresentation != null) {
110        protocol.writeFieldBegin("inputRepresentation", 2, TType.STRING);
111        protocol.writeString(struct.inputRepresentation);
112        protocol.writeFieldEnd();
113      }
114      protocol.writeFieldStop();
115      protocol.writeStructEnd();
116    }
117
118    @Override
119    public TreeGenOutput read(Protocol protocol, Builder builder) throws IOException {
120      protocol.readStructBegin();
121      while (true) {
122        FieldMetadata field = protocol.readFieldBegin();
123        if (field.typeId == TType.STOP) {
124          break;
125        }
126        switch (field.fieldId) {
127          case 1: {
128            if (field.typeId == TType.STRUCT) {
129              com.getkeepsafe.dexcount.thrift.PackageTree value = com.getkeepsafe.dexcount.thrift.PackageTree.ADAPTER.read(protocol);
130              builder.tree(value);
131            } else {
132              ProtocolUtil.skip(protocol, field.typeId);
133            }
134          }
135          break;
136          case 2: {
137            if (field.typeId == TType.STRING) {
138              String value = protocol.readString();
139              builder.inputRepresentation(value);
140            } else {
141              ProtocolUtil.skip(protocol, field.typeId);
142            }
143          }
144          break;
145          default: {
146            ProtocolUtil.skip(protocol, field.typeId);
147          }
148          break;
149        }
150        protocol.readFieldEnd();
151      }
152      protocol.readStructEnd();
153      return builder.build();
154    }
155
156    @Override
157    public TreeGenOutput read(Protocol protocol) throws IOException {
158      return read(protocol, new Builder());
159    }
160  }
161}