public function printExtension(Printer $printer, FieldDescriptorProto $field)
 {
     if (ExtensionPool::has($field->getExtendee(), $field->getNumber())) {
         // NOTE: already registered.
         return;
     }
     ExtensionPool::register($field->getExtendee(), $field->getNumber(), $field);
     $printer->put("\$registry->add('`message`', `extension`, new \\ProtocolBuffers\\FieldDescriptor(array(\n", "message", Helper::getExtendeeClassName($field), "extension", $field->getNumber());
     $printer->indent();
     $printer->put("\"type\"     => `type`,\n", "type", Helper::getFieldTypeName($field));
     $printer->put("\"name\"     => \"`name`\",\n", "name", $field->getName());
     $printer->put("\"required\" => `required`,\n", "required", FieldDescriptorProto\Label::isRequired($field) ? "true" : "false");
     $printer->put("\"optional\" => `optional`,\n", "optional", FieldDescriptorProto\Label::isOptional($field) ? "true" : "false");
     $printer->put("\"repeated\" => `repeated`,\n", "repeated", FieldDescriptorProto\Label::isRepeated($field) ? "true" : "false");
     $printer->put("\"packable\" => `packable`,\n", "packable", FieldDescriptorProto\Label::isPacked($field) ? "true" : "false");
     $printer->put("\"default\"  => `value`,\n", "value", $this->defaultValueAsString($field));
     if (FieldDescriptorProto\Type::isMessage($field)) {
         $name = $field->getTypeName();
         $descriptor = MessagePool::get($name);
         $printer->put("\"message\" => '`message`',\n", "message", Helper::getClassName($descriptor, true));
     }
     $printer->outdent();
     $printer->put(")));\n");
 }