Adds a stanza extension to the packet. Does nothing if extension is null.

@param extension a stanza extension.
180715
public void addExtension(ExtensionElement extension) {
        if (extension == null) return;
        String key = XmppStringUtils.generateKey(extension.getElementName(), extension.getNamespace());
        synchronized (packetExtensions) {
            packetExtensions.put(key, extension);
        }
    }
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;
}
687303
protected void addExtrasToIntent(Context context, Intent intent) {
        intent.putExtra(EXTRA_DROPBOX_UID, uid);
        intent.putExtra(EXTRA_CALLING_PACKAGE, context.getPackageName());
    }
264137
public void addMimeMapping(String extension, String type) {
        _mimeMap.put(StringUtils.asciiToLowerCase(extension), normalizeMimeType(type));
    }
159932
public WebSocketProtocolHandshakeHandler addExtension(ExtensionHandshake extension) {
        if (extension != null) {
            for (Handshake handshake : handshakes) {
                handshake.addExtension(extension);
            }
        }
        return this;
    }
479717
public void addRule (String description, String... extensions) {
		rules.add(new Rule(description, extensions));
	}
634192
def _registerExtension(self, extension, rtiRegItem):
        
        check_is_a_string(extension)
        check_class(rtiRegItem, RtiRegItem)

        logger.debug("  Registering extension {!r} for {}".format(extension, rtiRegItem))

        # TODO: type checking
        if extension in self._extensionMap:
            logger.info("Overriding extension {!r}: old={}, new={}"
                        .format(extension, self._extensionMap[extension], rtiRegItem))
        self._extensionMap[extension] = rtiRegItem
241916
private static void addMimeToCompressedWithExtension(String extension) {
        String mime = EXTENSIONS.get(extension);
        if (mime != null && !COMPRESSED_MIME.contains(mime)) {
            COMPRESSED_MIME.add(mime);
        }
    }
842957
@Nonnull
  public PreprocessorContext setExtensions(@Nonnull @MustNotContainNull final List<String> extensions) {
    this.extensions = new HashSet<>(assertDoesntContainNull(extensions));
    return this;
  }
1040692
public void addExtends(String superType) {
		if (!Strings.isEmpty(superType)) {
			JvmParameterizedTypeReference superTypeRef = newTypeRef(this.container, superType);
			this.sarlInterface.getExtends().add(superTypeRef);
			return;
		}
	}
464975
public void addExtends(String superType) {
		if (!Strings.isEmpty(superType)
				&& !Capacity.class.getName().equals(superType)) {
			JvmParameterizedTypeReference superTypeRef = newTypeRef(this.sarlCapacity, superType);
			JvmTypeReference baseTypeRef = findType(this.sarlCapacity, Capacity.class.getCanonicalName());
			if (isSubTypeOf(this.sarlCapacity, superTypeRef, baseTypeRef)) {
				this.sarlCapacity.getExtends().add(superTypeRef);
				return;
			}
		}
	}
1094326
protected void updateExtension(Extension value, String xmlTag, Counter counter, Element element)
   {
      Element root = element;
      Counter innerCount = new Counter(counter.getDepth() + 1);
      findAndReplaceSimpleElement(innerCount, root, "groupId", value.getGroupId(), null);
      findAndReplaceSimpleElement(innerCount, root, "artifactId", value.getArtifactId(), null);
      findAndReplaceSimpleElement(innerCount, root, "version", value.getVersion(), null);
   }
1154248
private void extend() {
        while (!this.extension.empty()) {
            final int lit = this.extension.back();
            int other;
            boolean satisfied = false;
            while ((other = this.extension.back()) != 0) {
                this.extension.pop();
                if (val(other) == VALUE_TRUE) { satisfied = true; }
            }
            this.extension.pop();
            if (!satisfied) { this.vals.set(Math.abs(lit), sign(lit)); }
        }
    }
24510
public void registerExtensions(final Class<?>... extensions) {
        for (Class<?> extension : extensions) {
            register(ConfigItem.Extension, extension);
        }
    }
330848
public static void addMention(Stanza stanza, int begin, int end, BareJid jid) {
        URI uri;
        try {
            uri = new URI("xmpp:" + jid.toString());
        } catch (URISyntaxException e) {
            throw new AssertionError("Cannot create URI from bareJid.");
        }
        ReferenceElement reference = new ReferenceElement(begin, end, ReferenceElement.Type.mention, null, uri);
        stanza.addExtension(reference);
    }
1242981
public function addExtensions(Extension ...$extensions): void
    {
        foreach ($extensions as $extension)
        {
            $this->extensions->attach($extension);
        }
    }
1060807
public ExtensionElement overrideExtension(ExtensionElement extension) {
        if (extension == null) return null;
        synchronized (packetExtensions) {
            // Note that we need to use removeExtension(String, String) here. If would use
            // removeExtension(ExtensionElement) then we would remove based on the equality of ExtensionElement, which
            // is not what we want in this case.
            ExtensionElement removedExtension = removeExtension(extension.getElementName(), extension.getNamespace());
            addExtension(extension);
            return removedExtension;
        }
    }