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

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

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

Message.getMessageSubject介绍

暂无

代码示例

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

  1. /**
  2. * Returns the subject corresponding to the language. If the language is null, the method result
  3. * will be the same as {@link #getSubject()}. Null will be returned if the language does not have
  4. * a corresponding subject.
  5. *
  6. * @param language the language of the subject to return.
  7. * @return the subject related to the passed in language.
  8. */
  9. public String getSubject(String language) {
  10. Subject subject = getMessageSubject(language);
  11. return subject == null ? null : subject.subject;
  12. }

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

  1. /**
  2. * Returns all the languages being used for the subjects, not including the default subject.
  3. *
  4. * @return the languages being used for the subjects.
  5. */
  6. public List<String> getSubjectLanguages() {
  7. Subject defaultSubject = getMessageSubject(null);
  8. List<String> languages = new ArrayList<String>();
  9. for (Subject subject : subjects) {
  10. if (!subject.equals(defaultSubject)) {
  11. languages.add(subject.language);
  12. }
  13. }
  14. return Collections.unmodifiableList(languages);
  15. }

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

  1. @Override
  2. public XmlStringBuilder toXML(String enclosingNamespace) {
  3. XmlStringBuilder buf = new XmlStringBuilder(enclosingNamespace);
  4. buf.halfOpenElement(ELEMENT);
  5. enclosingNamespace = addCommonAttributes(buf, enclosingNamespace);
  6. buf.optAttribute("type", type);
  7. buf.rightAngleBracket();
  8. // Add the subject in the default language
  9. Subject defaultSubject = getMessageSubject(null);
  10. if (defaultSubject != null) {
  11. buf.element("subject", defaultSubject.subject);
  12. }
  13. // Add the subject in other languages
  14. for (Subject subject : getSubjects()) {
  15. // Skip the default language
  16. if (subject.equals(defaultSubject))
  17. continue;
  18. buf.append(subject.toXML(null));
  19. }
  20. buf.optElement("thread", thread);
  21. // Append the error subpacket if the message type is an error.
  22. if (type == Type.error) {
  23. appendErrorIfExists(buf, enclosingNamespace);
  24. }
  25. // Add extension elements, if any are defined.
  26. buf.append(getExtensions(), enclosingNamespace);
  27. buf.closeElement(ELEMENT);
  28. return buf;
  29. }

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

  1. /**
  2. * Returns the subject corresponding to the language. If the language is null, the method result
  3. * will be the same as {@link #getSubject()}. Null will be returned if the language does not have
  4. * a corresponding subject.
  5. *
  6. * @param language the language of the subject to return.
  7. * @return the subject related to the passed in language.
  8. */
  9. public String getSubject(String language) {
  10. Subject subject = getMessageSubject(language);
  11. return subject == null ? null : subject.subject;
  12. }

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

  1. /**
  2. * Returns the subject corresponding to the language. If the language is null, the method result
  3. * will be the same as {@link #getSubject()}. Null will be returned if the language does not have
  4. * a corresponding subject.
  5. *
  6. * @param language the language of the subject to return.
  7. * @return the subject related to the passed in language.
  8. */
  9. public String getSubject(String language) {
  10. Subject subject = getMessageSubject(language);
  11. return subject == null ? null : subject.subject;
  12. }

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

  1. /**
  2. * Returns the subject corresponding to the language. If the language is null, the method result
  3. * will be the same as {@link #getSubject()}. Null will be returned if the language does not have
  4. * a corresponding subject.
  5. *
  6. * @param language the language of the subject to return.
  7. * @return the subject related to the passed in language.
  8. */
  9. public String getSubject(String language) {
  10. Subject subject = getMessageSubject(language);
  11. return subject == null ? null : subject.subject;
  12. }

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

  1. /**
  2. * Returns the subject corresponding to the language. If the language is null, the method result
  3. * will be the same as {@link #getSubject()}. Null will be returned if the language does not have
  4. * a corresponding subject.
  5. *
  6. * @param language the language of the subject to return.
  7. * @return the subject related to the passed in language.
  8. */
  9. public String getSubject(String language) {
  10. Subject subject = getMessageSubject(language);
  11. return subject == null ? null : subject.subject;
  12. }

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

  1. /**
  2. * Returns all the languages being used for the subjects, not including the default subject.
  3. *
  4. * @return the languages being used for the subjects.
  5. */
  6. public Collection<String> getSubjectLanguages() {
  7. Subject defaultSubject = getMessageSubject(null);
  8. List<String> languages = new ArrayList<String>();
  9. for (Subject subject : subjects) {
  10. if (!subject.equals(defaultSubject)) {
  11. languages.add(subject.language);
  12. }
  13. }
  14. return Collections.unmodifiableCollection(languages);
  15. }

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

  1. /**
  2. * Returns all the languages being used for the subjects, not including the default subject.
  3. *
  4. * @return the languages being used for the subjects.
  5. */
  6. public List<String> getSubjectLanguages() {
  7. Subject defaultSubject = getMessageSubject(null);
  8. List<String> languages = new ArrayList<String>();
  9. for (Subject subject : subjects) {
  10. if (!subject.equals(defaultSubject)) {
  11. languages.add(subject.language);
  12. }
  13. }
  14. return Collections.unmodifiableList(languages);
  15. }

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

  1. /**
  2. * Returns all the languages being used for the subjects, not including the default subject.
  3. *
  4. * @return the languages being used for the subjects.
  5. */
  6. public Collection<String> getSubjectLanguages() {
  7. Subject defaultSubject = getMessageSubject(null);
  8. List<String> languages = new ArrayList<String>();
  9. for (Subject subject : subjects) {
  10. if (!subject.equals(defaultSubject)) {
  11. languages.add(subject.language);
  12. }
  13. }
  14. return Collections.unmodifiableCollection(languages);
  15. }

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

  1. /**
  2. * Returns all the languages being used for the subjects, not including the default subject.
  3. *
  4. * @return the languages being used for the subjects.
  5. */
  6. public Collection<String> getSubjectLanguages() {
  7. Subject defaultSubject = getMessageSubject(null);
  8. List<String> languages = new ArrayList<String>();
  9. for (Subject subject : subjects) {
  10. if (!subject.equals(defaultSubject)) {
  11. languages.add(subject.language);
  12. }
  13. }
  14. return Collections.unmodifiableCollection(languages);
  15. }

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

  1. Subject defaultSubject = getMessageSubject(null);
  2. if (defaultSubject != null) {
  3. buf.append("<subject>").append(StringUtils.escapeForXML(defaultSubject.subject)).append("</subject>");

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

  1. Subject defaultSubject = getMessageSubject(null);
  2. if (defaultSubject != null) {
  3. buf.append("<subject>").append(StringUtils.escapeForXML(defaultSubject.subject)).append("</subject>");

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

  1. Subject defaultSubject = getMessageSubject(null);
  2. if (defaultSubject != null) {
  3. buf.append("<subject>").append(StringUtils.escapeForXML(defaultSubject.subject)).append("</subject>");

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

  1. @Override
  2. public XmlStringBuilder toXML(String enclosingNamespace) {
  3. XmlStringBuilder buf = new XmlStringBuilder(enclosingNamespace);
  4. buf.halfOpenElement(ELEMENT);
  5. enclosingNamespace = addCommonAttributes(buf, enclosingNamespace);
  6. buf.optAttribute("type", type);
  7. buf.rightAngleBracket();
  8. // Add the subject in the default language
  9. Subject defaultSubject = getMessageSubject(null);
  10. if (defaultSubject != null) {
  11. buf.element("subject", defaultSubject.subject);
  12. }
  13. // Add the subject in other languages
  14. for (Subject subject : getSubjects()) {
  15. // Skip the default language
  16. if (subject.equals(defaultSubject))
  17. continue;
  18. buf.append(subject.toXML(null));
  19. }
  20. buf.optElement("thread", thread);
  21. // Append the error subpacket if the message type is an error.
  22. if (type == Type.error) {
  23. appendErrorIfExists(buf, enclosingNamespace);
  24. }
  25. // Add extension elements, if any are defined.
  26. buf.append(getExtensions(), enclosingNamespace);
  27. buf.closeElement(ELEMENT);
  28. return buf;
  29. }

相关文章