docs: private static final ProtoFieldInterpreter enumTypeField(final EnumDescriptor enumDescriptor) {
      return new ProtoFieldInterpreter() {
  
        @Override
        public SoyValue soyFromProto(Object field) {
          int value;
          if (field instanceof ProtocolMessageEnum) {
            value = ((ProtocolMessageEnum) field).getNumber();
          } else {
            // The value will be an EnumValueDescriptor when fetched via reflection or a
            // ProtocolMessageEnum otherwise.  Who knows why.
            value = ((EnumValueDescriptor) field).getNumber();
          }
          return IntegerData.forValue(value);
        }
  
        @Override
        Object protoFromSoy(SoyValue field) {
          // The proto reflection api wants the EnumValueDescriptor, not the actual enum instance
          int value = field.integerValue();
          // in proto3 we preserve unknown enum values (for consistency with jbcsrc), but for proto2
          // we don't, and so if the field is unknown we will return null which will trigger an NPE
          // again, for consistency with jbcsrc.
          if (enumDescriptor.getFile().getSyntax() == Syntax.PROTO3) {
            return enumDescriptor.findValueByNumberCreatingIfUnknown(value);
          }
          return enumDescriptor.findValueByNumber(value);
        }
      };
    }