Adds extension to the registry, making a default DynamicMessage if its type is a Message.
186980
public static ExtensionRegistry addToRegistry(final FieldDescriptor extension,
      final ExtensionRegistry registry) {
    if (extension.getJavaType() == JavaType.MESSAGE) {
      registry.add(extension, DynamicMessage.getDefaultInstance(extension.getMessageType()));
    } else {
      registry.add(extension);
    }

    return registry;
  }
963029
public static function assumeExtensionLoaded($extension, $message = ''): void
    {
        assumeThat(\extension_loaded($extension), is(true), $message);
    }
29169
def add_extension(self, klass, extension):
        
        klass = self._get_class_path(klass)

        # TODO: Take order into account.
        self._extensions.setdefault(klass, []).append(extension)
1188404
public static void registerExtension (String extension, Class<? extends StreamDecoder> clazz)
    {
        _extensions.put(extension, clazz);
    }
207905
public B addExtensionElement(BpmnModelElementInstance extensionElement) {
    ExtensionElements extensionElements = getCreateSingleChild(ExtensionElements.class);
    extensionElements.addChildElement(extensionElement);
    return myself;
  }
122674
def add_mimetype(mimedb, mimetype, extension):
    """"""
    # If extension is already a common type, strict=True must be used.
    strict = extension in mimedb.types_map[True]
    mimedb.add_type(mimetype, extension, strict=strict)
278148
function registerExtension(extension) {
    try {
        var ext; // Actual extension

        if (is(extension, 'buildCore', 'function')) {
            // If extension has buildCore function then give it an instance of the core.
            extension.buildCore(self);
            addOne(extensions, extension);
            return; // No need to extend as that will be handled in buildCore
        }

        if (is(extension, 'function')) {
            // If extension is a function then give it an instance of the core.
            ext = extension(self);
        } else if (has(extension, 'core')) {
            // If extension has `core` property then extend core with it.
            ext = extension.core;
        } else {
            // Otherwise extend core with the extension itself.
            ext = extension;
        }

        if (ext) {
            extend(self, ext);
            addOne(extensions, extension);
        }
    } catch (ex) {
        error('Fatal error during application initialization. ', 'Failed to build core with extension "', extension, 'See following exception for more details.', ex);
    }

    return extension;
}
68568
def add_extension(self, extension):
        
        instance = werkzeug.utils.import_string(extension)

        if hasattr(instance, 'register'):
            instance.register(self)

        self._extensions.append(instance)
1345739
def __DeclareMessageAlias(self, schema, alias_for):
        """"""
        # TODO(craigcitro): This is a hack. Remove it.
        message = extended_descriptor.ExtendedMessageDescriptor()
        message.name = self.__names.ClassName(schema['id'])
        message.alias_for = alias_for
        self.__DeclareDescriptor(message.name)
        self.__AddImport('from %s import extra_types' %
                         self.__base_files_package)
        self.__RegisterDescriptor(message)
688888
public BType addBuilder(final MType message) {
    ensureMutableMessageList();
    ensureBuilders();
    final SingleFieldBuilder<MType, BType, IType> builder =
        newSingleFieldBuilder(message, this, isClean);
    messages.add(null);
    builders.add(builder);
    onChanged();
    incrementModCounts();
    return builder.getBuilder();
  }
315595
def add(self, extension):
        
        index = len(self.extensions)
        self.extensions[index] = extension
        for protocol in extension.protocols:
            self.registry[protocol] = index
703559
def _AddHasExtensionMethod(cls):
  """"""
  def HasExtension(self, extension_handle):
    _VerifyExtensionHandle(self, extension_handle)
    if extension_handle.label == _FieldDescriptor.LABEL_REPEATED:
      raise KeyError('"%s" is repeated.' % extension_handle.full_name)

    if extension_handle.cpp_type == _FieldDescriptor.CPPTYPE_MESSAGE:
      value = self._fields.get(extension_handle)
      return value is not None and value._is_present_in_parent
    else:
      return extension_handle in self._fields
  cls.HasExtension = HasExtension
1333635
public void add(final FieldDescriptor type) {
    if (type.getJavaType() == FieldDescriptor.JavaType.MESSAGE) {
      throw new IllegalArgumentException(
        "ExtensionRegistry.add() must be provided a default instance when " +
        "adding an embedded message extension.");
    }
    add(new ExtensionInfo(type, null));
  }
512022
def add_message(message)
      @messages.key?(message.name) and raise SpecificationError,
        "A message named #{message.name} was already defined in #@protocol"
      @messages[message.name] = message
    end
110697
@Nonnull
  public final HandlerRegistration addMessageHandler( @Nonnull final MessageEvent.Handler handler )
  {
    return _eventBus.addHandler( MessageEvent.getType(), handler );
  }
866854
def _add_info(self, msg, **kwargs):
        

        args, extensions = self._filter_args(msg, **kwargs)
        for key, val in args.items():
            setattr(msg, key, val)

        if extensions:
            if msg.extension_elements:
                msg.extension_elements.extend(extensions)
            else:
                msg.extension_elements = extensions
1165226
public void addMessageNow(String message) {
    ActionMessages messages = (ActionMessages) now.get(Flash.MESSAGES);
    if (null == messages) {
      messages = new ActionMessages();
      now.put(Flash.MESSAGES, messages);
    }
    messages.getMessages().add(message);
  }