本文整理汇总了Java中org.jxmpp.util.XmppStringUtils.generateKey方法的典型用法代码示例。如果您正苦于以下问题:Java XmppStringUtils.generateKey方法的具体用法?Java XmppStringUtils.generateKey怎么用?Java XmppStringUtils.generateKey使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jxmpp.util.XmppStringUtils
的用法示例。
在下文中一共展示了XmppStringUtils.generateKey方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: registerIQRequestHandler
import org.jxmpp.util.XmppStringUtils; //导入方法依赖的package包/类
@Override
public IQRequestHandler registerIQRequestHandler(final IQRequestHandler iqRequestHandler) {
final String key = XmppStringUtils.generateKey(iqRequestHandler.getElement(), iqRequestHandler.getNamespace());
switch (iqRequestHandler.getType()) {
case set:
synchronized (setIqRequestHandler) {
return setIqRequestHandler.put(key, iqRequestHandler);
}
case get:
synchronized (getIqRequestHandler) {
return getIqRequestHandler.put(key, iqRequestHandler);
}
default:
throw new IllegalArgumentException("Only IQ type of 'get' and 'set' allowed");
}
}
示例2: unregisterIQRequestHandler
import org.jxmpp.util.XmppStringUtils; //导入方法依赖的package包/类
@Override
public IQRequestHandler unregisterIQRequestHandler(String element, String namespace, IQ.Type type) {
final String key = XmppStringUtils.generateKey(element, namespace);
switch (type) {
case set:
synchronized (setIqRequestHandler) {
return setIqRequestHandler.remove(key);
}
case get:
synchronized (getIqRequestHandler) {
return getIqRequestHandler.remove(key);
}
default:
throw new IllegalArgumentException("Only IQ type of 'get' and 'set' allowed");
}
}
示例3: getExtension
import org.jxmpp.util.XmppStringUtils; //导入方法依赖的package包/类
/**
* Returns the first extension that matches the specified element name and
* namespace, or <tt>null</tt> if it doesn't exist. If the provided elementName is null,
* only the namespace is matched. Extensions are
* are arbitrary XML sub-documents in standard XMPP packets. By default, a
* {@link DefaultExtensionElement} instance will be returned for each extension. However,
* ExtensionElementProvider instances can be registered with the
* {@link org.jivesoftware.smack.provider.ProviderManager ProviderManager}
* class to handle custom parsing. In that case, the type of the Object
* will be determined by the provider.
*
* @param elementName the XML element name of the extension. (May be null)
* @param namespace the XML element namespace of the extension.
* @return the extension, or <tt>null</tt> if it doesn't exist.
*/
@SuppressWarnings("unchecked")
public <PE extends ExtensionElement> PE getExtension(String elementName, String namespace) {
if (namespace == null) {
return null;
}
String key = XmppStringUtils.generateKey(elementName, namespace);
ExtensionElement packetExtension;
synchronized (packetExtensions) {
packetExtension = packetExtensions.getFirst(key);
}
if (packetExtension == null) {
return null;
}
return (PE) packetExtension;
}
示例4: addExtension
import org.jxmpp.util.XmppStringUtils; //导入方法依赖的package包/类
/**
* Adds a stanza(/packet) extension to the packet. Does nothing if extension is null.
*
* @param extension a stanza(/packet) extension.
*/
public void addExtension(ExtensionElement extension) {
if (extension == null) return;
String key = XmppStringUtils.generateKey(extension.getElementName(), extension.getNamespace());
synchronized (packetExtensions) {
packetExtensions.put(key, extension);
}
}
示例5: addStreamFeature
import org.jxmpp.util.XmppStringUtils; //导入方法依赖的package包/类
private void addStreamFeature(ExtensionElement feature) {
String key = XmppStringUtils.generateKey(feature.getElementName(), feature.getNamespace());
streamFeatures.put(key, feature);
}
示例6: getKey
import org.jxmpp.util.XmppStringUtils; //导入方法依赖的package包/类
private static String getKey(String elementName, String namespace) {
return XmppStringUtils.generateKey(elementName, namespace);
}
示例7: getExtensions
import org.jxmpp.util.XmppStringUtils; //导入方法依赖的package包/类
/**
* Return a set of all extensions with the given element name <emph>and</emph> namespace.
* <p>
* Changes to the returned set will update the stanza(/packet) extensions, if the returned set is not the empty set.
* </p>
*
* @param elementName the element name, must not be null.
* @param namespace the namespace of the element(s), must not be null.
* @return a set of all matching extensions.
* @since 4.1
*/
public Set<ExtensionElement> getExtensions(String elementName, String namespace) {
requireNotNullOrEmpty(elementName, "elementName must not be null or empty");
requireNotNullOrEmpty(namespace, "namespace must not be null or empty");
String key = XmppStringUtils.generateKey(elementName, namespace);
return packetExtensions.getAll(key);
}
示例8: hasExtension
import org.jxmpp.util.XmppStringUtils; //导入方法依赖的package包/类
/**
* Check if a stanza(/packet) extension with the given element and namespace exists.
* <p>
* The argument <code>elementName</code> may be null.
* </p>
*
* @param elementName
* @param namespace
* @return true if a stanza(/packet) extension exists, false otherwise.
*/
public boolean hasExtension(String elementName, String namespace) {
if (elementName == null) {
return hasExtension(namespace);
}
String key = XmppStringUtils.generateKey(elementName, namespace);
synchronized (packetExtensions) {
return packetExtensions.containsKey(key);
}
}
示例9: removeExtension
import org.jxmpp.util.XmppStringUtils; //导入方法依赖的package包/类
/**
* Remove the stanza(/packet) extension with the given elementName and namespace.
*
* @param elementName
* @param namespace
* @return the removed stanza(/packet) extension or null.
*/
public ExtensionElement removeExtension(String elementName, String namespace) {
String key = XmppStringUtils.generateKey(elementName, namespace);
synchronized (packetExtensions) {
return packetExtensions.remove(key);
}
}
示例10: Identity
import org.jxmpp.util.XmppStringUtils; //导入方法依赖的package包/类
/**
* Creates a new identity for an XMPP entity.
* 'category' and 'type' are required by
* <a href="http://xmpp.org/extensions/xep-0030.html#schemas">XEP-30 XML Schemas</a>
*
* @param category the entity's category (required as per XEP-30).
* @param type the entity's type (required as per XEP-30).
* @param name the entity's name.
* @param lang the entity's lang.
*/
public Identity(String category, String type, String name, String lang) {
this.category = StringUtils.requireNotNullOrEmpty(category, "category cannot be null");
this.type = StringUtils.requireNotNullOrEmpty(type, "type cannot be null");
this.key = XmppStringUtils.generateKey(category, type);
this.name = name;
this.lang = lang;
}
示例11: hasIdentity
import org.jxmpp.util.XmppStringUtils; //导入方法依赖的package包/类
/**
* Returns true if this DiscoverInfo contains at least one Identity of the given category and type.
*
* @param category the category to look for.
* @param type the type to look for.
* @return true if this DiscoverInfo contains a Identity of the given category and type.
*/
public boolean hasIdentity(String category, String type) {
String key = XmppStringUtils.generateKey(category, type);
return identitiesSet.contains(key);
}