in library/src/main/java/com/theguardian/bridget/thrift/Image.java [630:695]
public void read(org.apache.thrift.protocol.TProtocol iprot, Image struct) throws org.apache.thrift.TException {
org.apache.thrift.protocol.TField schemeField;
iprot.readStructBegin();
while (true)
{
schemeField = iprot.readFieldBegin();
if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
break;
}
switch (schemeField.id) {
case 1: // URL
if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
struct.url = iprot.readString();
struct.setUrlIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 2: // WIDTH
if (schemeField.type == org.apache.thrift.protocol.TType.DOUBLE) {
struct.width = iprot.readDouble();
struct.setWidthIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 3: // HEIGHT
if (schemeField.type == org.apache.thrift.protocol.TType.DOUBLE) {
struct.height = iprot.readDouble();
struct.setHeightIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 4: // CAPTION
if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
struct.caption = iprot.readString();
struct.setCaptionIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 5: // CREDIT
if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
struct.credit = iprot.readString();
struct.setCreditIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
default:
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
iprot.readFieldEnd();
}
iprot.readStructEnd();
// check for required fields of primitive type, which can't be checked in the validate method
if (!struct.isSetWidth()) {
throw new org.apache.thrift.protocol.TProtocolException("Required field 'width' was not found in serialized data! Struct: " + toString());
}
if (!struct.isSetHeight()) {
throw new org.apache.thrift.protocol.TProtocolException("Required field 'height' was not found in serialized data! Struct: " + toString());
}
struct.validate();
}