Re: [protobuf] proto3 hasField return error

2017-01-05 Thread 'Adam Cozzette' via Protocol Buffers
This behavior is to be expected, because in proto3 there is no notion of field presence for primitive type fields (more about this here ). Proto3 does not make a distinction between that field being unset and being set to its

[protobuf] proto3 hasField return error

2017-01-04 Thread simon . zhang . xi
public class Test { public static void main(String[] args) throws Exception { Device device = Device.newBuilder() .setMeterAperture(0) .build(); // device.getMeterAlarm(); System.out.println(device.hasField(Device.getDescriptor().findFieldByNumber(Device.METER_APERTURE_FIELD_NUMBER))); // PRINT