org.jivesoftware.smack.packet.Message.getSubjects()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(3.1k)|赞(0)|评价(0)|浏览(135)

本文整理了Java中org.jivesoftware.smack.packet.Message.getSubjects()方法的一些代码示例,展示了Message.getSubjects()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Message.getSubjects()方法的具体详情如下:
包路径:org.jivesoftware.smack.packet.Message
类名称:Message
方法名:getSubjects

Message.getSubjects介绍

[英]Returns a set of all subjects in this Message, including the default message subject accessible from #getSubject().
[中]返回此消息中所有主题的集合,包括可从#getSubject()访问的默认消息主题。

代码示例

代码示例来源:origin: igniterealtime/Smack

@Override
public XmlStringBuilder toXML(String enclosingNamespace) {
  XmlStringBuilder buf = new XmlStringBuilder(enclosingNamespace);
  buf.halfOpenElement(ELEMENT);
  enclosingNamespace = addCommonAttributes(buf, enclosingNamespace);
  buf.optAttribute("type", type);
  buf.rightAngleBracket();
  // Add the subject in the default language
  Subject defaultSubject = getMessageSubject(null);
  if (defaultSubject != null) {
    buf.element("subject", defaultSubject.subject);
  }
  // Add the subject in other languages
  for (Subject subject : getSubjects()) {
    // Skip the default language
    if (subject.equals(defaultSubject))
      continue;
    buf.append(subject.toXML(null));
  }
  buf.optElement("thread", thread);
  // Append the error subpacket if the message type is an error.
  if (type == Type.error) {
    appendErrorIfExists(buf, enclosingNamespace);
  }
  // Add extension elements, if any are defined.
  buf.append(getExtensions(), enclosingNamespace);
  buf.closeElement(ELEMENT);
  return buf;
}

代码示例来源:origin: igniterealtime/Smack

assertEquals(2, message.getSubjects().size());
assertEquals(1, message.getSubjectLanguages().size());
assertTrue(message.getSubjectLanguages().contains(otherLanguage));
assertEquals(1, message.getSubjects().size());
assertEquals(0, message.getSubjectLanguages().size());
assertXMLNotEqual(control, message.toXML(StreamOpen.CLIENT_NAMESPACE).toString());
assertEquals(2, message.getSubjects().size());
assertEquals(1, message.getSubjectLanguages().size());
assertTrue(message.getSubjectLanguages().contains(defaultLanguage));

代码示例来源:origin: org.igniterealtime.smack/smack

for (Subject subject : getSubjects()) {

代码示例来源:origin: org.littleshoot/smack-xmpp-3-2-2

for (Subject subject : getSubjects()) {

代码示例来源:origin: tiandawu/IotXmpp

for (Subject subject : getSubjects()) {

代码示例来源:origin: org.igniterealtime.smack/smack-core

@Override
public XmlStringBuilder toXML(String enclosingNamespace) {
  XmlStringBuilder buf = new XmlStringBuilder(enclosingNamespace);
  buf.halfOpenElement(ELEMENT);
  enclosingNamespace = addCommonAttributes(buf, enclosingNamespace);
  buf.optAttribute("type", type);
  buf.rightAngleBracket();
  // Add the subject in the default language
  Subject defaultSubject = getMessageSubject(null);
  if (defaultSubject != null) {
    buf.element("subject", defaultSubject.subject);
  }
  // Add the subject in other languages
  for (Subject subject : getSubjects()) {
    // Skip the default language
    if (subject.equals(defaultSubject))
      continue;
    buf.append(subject.toXML(null));
  }
  buf.optElement("thread", thread);
  // Append the error subpacket if the message type is an error.
  if (type == Type.error) {
    appendErrorIfExists(buf, enclosingNamespace);
  }
  // Add extension elements, if any are defined.
  buf.append(getExtensions(), enclosingNamespace);
  buf.closeElement(ELEMENT);
  return buf;
}

相关文章