writeInt(fieldName, value.intValue());
}
@Override
public void writeInt(String fieldName, int value) throws IOException {
FieldDescriptor fd = messageContext.marshallerDelegate.getFieldsByName().get(fieldName);
checkFieldWrite(fd, false);
//need to know which exact flavor of write to use depending on wire type
switch (fd.getType()) {
case INT32:
messageContext.out.writeInt32(fd.getNumber(), value);
break;
case FIXED32:
messageContext.out.writeFixed32(fd.getNumber(), value);
break;
case UINT32:
messageContext.out.writeUInt32(fd.getNumber(), value);
break;
case SFIXED32:
messageContext.out.writeSFixed32(fd.getNumber(), value);
break;
case SINT32:
messageContext.out.writeSInt32(fd.getNumber(), value);
break;
default:
throw new IllegalArgumentException("The declared field type is not compatible with the written type : " + fieldName);
}
}