All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.gdface.facedb.thrift.client.CodeInfo Maven / Gradle / Ivy

// Automatically generated by the Thrifty compiler; do not edit!
// Generated on: 2019-09-24T07:53:45.894Z
// Source: J:\facedb\FaceDb.thrift at 127:1
package net.gdface.facedb.thrift.client;

import com.microsoft.thrifty.Adapter;
import com.microsoft.thrifty.Struct;
import com.microsoft.thrifty.StructBuilder;
import com.microsoft.thrifty.TType;
import com.microsoft.thrifty.ThriftField;
import com.microsoft.thrifty.protocol.FieldMetadata;
import com.microsoft.thrifty.protocol.Protocol;
import com.microsoft.thrifty.util.ProtocolUtil;
import java.io.IOException;
import javax.annotation.Generated;
import okio.ByteString;

@Generated(
    value = "com.microsoft.thrifty.gen.ThriftyCodeGenerator",
    comments = "https://github.com/microsoft/thrifty"
)
public final class CodeInfo implements Struct {
  public static final Adapter ADAPTER = new CodeInfoAdapter();

  @ThriftField(
      fieldId = 1,
      isOptional = true
  )
  public final FAngle angle;

  @ThriftField(
      fieldId = 2,
      isOptional = true
  )
  public final ByteString code;

  @ThriftField(
      fieldId = 3,
      isOptional = true
  )
  public final EyeInfo ei;

  @ThriftField(
      fieldId = 4,
      isOptional = true
  )
  public final ByteString facialData;

  @ThriftField(
      fieldId = 5,
      isOptional = true
  )
  public final FInt2 mouth;

  @ThriftField(
      fieldId = 6,
      isOptional = true
  )
  public final FInt2 nose;

  @ThriftField(
      fieldId = 7,
      isOptional = true
  )
  public final FRect pos;

  private CodeInfo(Builder builder) {
    this.angle = builder.angle;
    this.code = builder.code;
    this.ei = builder.ei;
    this.facialData = builder.facialData;
    this.mouth = builder.mouth;
    this.nose = builder.nose;
    this.pos = builder.pos;
  }

  @Override
  public boolean equals(Object other) {
    if (this == other) return true;
    if (other == null) return false;
    if (!(other instanceof CodeInfo)) return false;
    CodeInfo that = (CodeInfo) other;
    return (this.angle == that.angle || (this.angle != null && this.angle.equals(that.angle)))
        && (this.code == that.code || (this.code != null && this.code.equals(that.code)))
        && (this.ei == that.ei || (this.ei != null && this.ei.equals(that.ei)))
        && (this.facialData == that.facialData || (this.facialData != null && this.facialData.equals(that.facialData)))
        && (this.mouth == that.mouth || (this.mouth != null && this.mouth.equals(that.mouth)))
        && (this.nose == that.nose || (this.nose != null && this.nose.equals(that.nose)))
        && (this.pos == that.pos || (this.pos != null && this.pos.equals(that.pos)));
  }

  @Override
  public int hashCode() {
    int code = 16777619;
    code ^= (this.angle == null) ? 0 : this.angle.hashCode();
    code *= 0x811c9dc5;
    code ^= (this.code == null) ? 0 : this.code.hashCode();
    code *= 0x811c9dc5;
    code ^= (this.ei == null) ? 0 : this.ei.hashCode();
    code *= 0x811c9dc5;
    code ^= (this.facialData == null) ? 0 : this.facialData.hashCode();
    code *= 0x811c9dc5;
    code ^= (this.mouth == null) ? 0 : this.mouth.hashCode();
    code *= 0x811c9dc5;
    code ^= (this.nose == null) ? 0 : this.nose.hashCode();
    code *= 0x811c9dc5;
    code ^= (this.pos == null) ? 0 : this.pos.hashCode();
    code *= 0x811c9dc5;
    return code;
  }

  @Override
  public String toString() {
    return "CodeInfo{angle=" + this.angle + ", code=" + this.code + ", ei=" + this.ei + ", facialData=" + this.facialData + ", mouth=" + this.mouth + ", nose=" + this.nose + ", pos=" + this.pos + "}";
  }

  @Override
  public void write(Protocol protocol) throws IOException {
    ADAPTER.write(protocol, this);
  }

  public static final class Builder implements StructBuilder {
    private FAngle angle;

    private ByteString code;

    private EyeInfo ei;

    private ByteString facialData;

    private FInt2 mouth;

    private FInt2 nose;

    private FRect pos;

    public Builder() {
    }

    public Builder(CodeInfo struct) {
      this.angle = struct.angle;
      this.code = struct.code;
      this.ei = struct.ei;
      this.facialData = struct.facialData;
      this.mouth = struct.mouth;
      this.nose = struct.nose;
      this.pos = struct.pos;
    }

    public Builder angle(FAngle angle) {
      this.angle = angle;
      return this;
    }

    public Builder code(ByteString code) {
      this.code = code;
      return this;
    }

    public Builder ei(EyeInfo ei) {
      this.ei = ei;
      return this;
    }

    public Builder facialData(ByteString facialData) {
      this.facialData = facialData;
      return this;
    }

    public Builder mouth(FInt2 mouth) {
      this.mouth = mouth;
      return this;
    }

    public Builder nose(FInt2 nose) {
      this.nose = nose;
      return this;
    }

    public Builder pos(FRect pos) {
      this.pos = pos;
      return this;
    }

    @Override
    public CodeInfo build() {
      return new CodeInfo(this);
    }

    @Override
    public void reset() {
      this.angle = null;
      this.code = null;
      this.ei = null;
      this.facialData = null;
      this.mouth = null;
      this.nose = null;
      this.pos = null;
    }
  }

  private static final class CodeInfoAdapter implements Adapter {
    @Override
    public void write(Protocol protocol, CodeInfo struct) throws IOException {
      protocol.writeStructBegin("CodeInfo");
      if (struct.angle != null) {
        protocol.writeFieldBegin("angle", 1, TType.STRUCT);
        net.gdface.facedb.thrift.client.FAngle.ADAPTER.write(protocol, struct.angle);
        protocol.writeFieldEnd();
      }
      if (struct.code != null) {
        protocol.writeFieldBegin("code", 2, TType.STRING);
        protocol.writeBinary(struct.code);
        protocol.writeFieldEnd();
      }
      if (struct.ei != null) {
        protocol.writeFieldBegin("ei", 3, TType.STRUCT);
        net.gdface.facedb.thrift.client.EyeInfo.ADAPTER.write(protocol, struct.ei);
        protocol.writeFieldEnd();
      }
      if (struct.facialData != null) {
        protocol.writeFieldBegin("facialData", 4, TType.STRING);
        protocol.writeBinary(struct.facialData);
        protocol.writeFieldEnd();
      }
      if (struct.mouth != null) {
        protocol.writeFieldBegin("mouth", 5, TType.STRUCT);
        net.gdface.facedb.thrift.client.FInt2.ADAPTER.write(protocol, struct.mouth);
        protocol.writeFieldEnd();
      }
      if (struct.nose != null) {
        protocol.writeFieldBegin("nose", 6, TType.STRUCT);
        net.gdface.facedb.thrift.client.FInt2.ADAPTER.write(protocol, struct.nose);
        protocol.writeFieldEnd();
      }
      if (struct.pos != null) {
        protocol.writeFieldBegin("pos", 7, TType.STRUCT);
        net.gdface.facedb.thrift.client.FRect.ADAPTER.write(protocol, struct.pos);
        protocol.writeFieldEnd();
      }
      protocol.writeFieldStop();
      protocol.writeStructEnd();
    }

    @Override
    public CodeInfo read(Protocol protocol, Builder builder) throws IOException {
      protocol.readStructBegin();
      while (true) {
        FieldMetadata field = protocol.readFieldBegin();
        if (field.typeId == TType.STOP) {
          break;
        }
        switch (field.fieldId) {
          case 1: {
            if (field.typeId == TType.STRUCT) {
              net.gdface.facedb.thrift.client.FAngle value = net.gdface.facedb.thrift.client.FAngle.ADAPTER.read(protocol);
              builder.angle(value);
            } else {
              ProtocolUtil.skip(protocol, field.typeId);
            }
          }
          break;
          case 2: {
            if (field.typeId == TType.STRING) {
              ByteString value = protocol.readBinary();
              builder.code(value);
            } else {
              ProtocolUtil.skip(protocol, field.typeId);
            }
          }
          break;
          case 3: {
            if (field.typeId == TType.STRUCT) {
              net.gdface.facedb.thrift.client.EyeInfo value = net.gdface.facedb.thrift.client.EyeInfo.ADAPTER.read(protocol);
              builder.ei(value);
            } else {
              ProtocolUtil.skip(protocol, field.typeId);
            }
          }
          break;
          case 4: {
            if (field.typeId == TType.STRING) {
              ByteString value = protocol.readBinary();
              builder.facialData(value);
            } else {
              ProtocolUtil.skip(protocol, field.typeId);
            }
          }
          break;
          case 5: {
            if (field.typeId == TType.STRUCT) {
              net.gdface.facedb.thrift.client.FInt2 value = net.gdface.facedb.thrift.client.FInt2.ADAPTER.read(protocol);
              builder.mouth(value);
            } else {
              ProtocolUtil.skip(protocol, field.typeId);
            }
          }
          break;
          case 6: {
            if (field.typeId == TType.STRUCT) {
              net.gdface.facedb.thrift.client.FInt2 value = net.gdface.facedb.thrift.client.FInt2.ADAPTER.read(protocol);
              builder.nose(value);
            } else {
              ProtocolUtil.skip(protocol, field.typeId);
            }
          }
          break;
          case 7: {
            if (field.typeId == TType.STRUCT) {
              net.gdface.facedb.thrift.client.FRect value = net.gdface.facedb.thrift.client.FRect.ADAPTER.read(protocol);
              builder.pos(value);
            } else {
              ProtocolUtil.skip(protocol, field.typeId);
            }
          }
          break;
          default: {
            ProtocolUtil.skip(protocol, field.typeId);
          }
          break;
        }
        protocol.readFieldEnd();
      }
      protocol.readStructEnd();
      return builder.build();
    }

    @Override
    public CodeInfo read(Protocol protocol) throws IOException {
      return read(protocol, new Builder());
    }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy