net.gdface.facedb.thrift.client.FRect Maven / Gradle / Ivy
// Automatically generated by the Thrifty compiler; do not edit!
// Generated on: 2019-09-24T07:53:45.883Z
// Source: J:\facedb\FaceDb.thrift at 27: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;
@Generated(
value = "com.microsoft.thrifty.gen.ThriftyCodeGenerator",
comments = "https://github.com/microsoft/thrifty"
)
public final class FRect implements Struct {
public static final Adapter ADAPTER = new FRectAdapter();
@ThriftField(
fieldId = 1,
isRequired = true
)
public final Integer height;
@ThriftField(
fieldId = 2,
isRequired = true
)
public final Integer left;
@ThriftField(
fieldId = 3,
isRequired = true
)
public final Integer top;
@ThriftField(
fieldId = 4,
isRequired = true
)
public final Integer width;
private FRect(Builder builder) {
this.height = builder.height;
this.left = builder.left;
this.top = builder.top;
this.width = builder.width;
}
@Override
@SuppressWarnings("NumberEquality")
public boolean equals(Object other) {
if (this == other) return true;
if (other == null) return false;
if (!(other instanceof FRect)) return false;
FRect that = (FRect) other;
return (this.height == that.height || this.height.equals(that.height))
&& (this.left == that.left || this.left.equals(that.left))
&& (this.top == that.top || this.top.equals(that.top))
&& (this.width == that.width || this.width.equals(that.width));
}
@Override
public int hashCode() {
int code = 16777619;
code ^= this.height.hashCode();
code *= 0x811c9dc5;
code ^= this.left.hashCode();
code *= 0x811c9dc5;
code ^= this.top.hashCode();
code *= 0x811c9dc5;
code ^= this.width.hashCode();
code *= 0x811c9dc5;
return code;
}
@Override
public String toString() {
return "FRect{height=" + this.height + ", left=" + this.left + ", top=" + this.top + ", width=" + this.width + "}";
}
@Override
public void write(Protocol protocol) throws IOException {
ADAPTER.write(protocol, this);
}
public static final class Builder implements StructBuilder {
private Integer height;
private Integer left;
private Integer top;
private Integer width;
public Builder() {
}
public Builder(FRect struct) {
this.height = struct.height;
this.left = struct.left;
this.top = struct.top;
this.width = struct.width;
}
public Builder height(Integer height) {
if (height == null) {
throw new NullPointerException("Required field 'height' cannot be null");
}
this.height = height;
return this;
}
public Builder left(Integer left) {
if (left == null) {
throw new NullPointerException("Required field 'left' cannot be null");
}
this.left = left;
return this;
}
public Builder top(Integer top) {
if (top == null) {
throw new NullPointerException("Required field 'top' cannot be null");
}
this.top = top;
return this;
}
public Builder width(Integer width) {
if (width == null) {
throw new NullPointerException("Required field 'width' cannot be null");
}
this.width = width;
return this;
}
@Override
public FRect build() {
if (this.height == null) {
throw new IllegalStateException("Required field 'height' is missing");
}
if (this.left == null) {
throw new IllegalStateException("Required field 'left' is missing");
}
if (this.top == null) {
throw new IllegalStateException("Required field 'top' is missing");
}
if (this.width == null) {
throw new IllegalStateException("Required field 'width' is missing");
}
return new FRect(this);
}
@Override
public void reset() {
this.height = null;
this.left = null;
this.top = null;
this.width = null;
}
}
private static final class FRectAdapter implements Adapter {
@Override
public void write(Protocol protocol, FRect struct) throws IOException {
protocol.writeStructBegin("FRect");
protocol.writeFieldBegin("height", 1, TType.I32);
protocol.writeI32(struct.height);
protocol.writeFieldEnd();
protocol.writeFieldBegin("left", 2, TType.I32);
protocol.writeI32(struct.left);
protocol.writeFieldEnd();
protocol.writeFieldBegin("top", 3, TType.I32);
protocol.writeI32(struct.top);
protocol.writeFieldEnd();
protocol.writeFieldBegin("width", 4, TType.I32);
protocol.writeI32(struct.width);
protocol.writeFieldEnd();
protocol.writeFieldStop();
protocol.writeStructEnd();
}
@Override
public FRect 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.I32) {
int value = protocol.readI32();
builder.height(value);
} else {
ProtocolUtil.skip(protocol, field.typeId);
}
}
break;
case 2: {
if (field.typeId == TType.I32) {
int value = protocol.readI32();
builder.left(value);
} else {
ProtocolUtil.skip(protocol, field.typeId);
}
}
break;
case 3: {
if (field.typeId == TType.I32) {
int value = protocol.readI32();
builder.top(value);
} else {
ProtocolUtil.skip(protocol, field.typeId);
}
}
break;
case 4: {
if (field.typeId == TType.I32) {
int value = protocol.readI32();
builder.width(value);
} else {
ProtocolUtil.skip(protocol, field.typeId);
}
}
break;
default: {
ProtocolUtil.skip(protocol, field.typeId);
}
break;
}
protocol.readFieldEnd();
}
protocol.readStructEnd();
return builder.build();
}
@Override
public FRect read(Protocol protocol) throws IOException {
return read(protocol, new Builder());
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy