/** * Return a list of all reference extensions contained in a stanza. * If there are no reference elements, return an empty list. * * @param stanza stanza * @return list of all references contained in the stanza */ public static List<ReferenceElement> getReferencesFromStanza(Stanza stanza) { List<ReferenceElement> references = new ArrayList<>(); List<ExtensionElement> extensions = stanza.getExtensions(ReferenceElement.ELEMENT, ReferenceManager.NAMESPACE); for (ExtensionElement e : extensions) { references.add((ReferenceElement) e); } return references; }
/** * Returns the first extension of this stanza that has the given namespace. * <p> * When possible, use {@link #getExtension(String,String)} instead. * </p> * * @param namespace the namespace of the extension that is desired. * @return the stanza extension with the given namespace. */ public ExtensionElement getExtension(String namespace) { return PacketUtil.extensionElementFrom(getExtensions(), null, namespace); }
protected Stanza(Stanza p) { id = p.getStanzaId(); to = p.getTo(); from = p.getFrom(); error = p.error; // Copy extensions for (ExtensionElement pe : p.getExtensions()) { addExtension(pe); } }
/** * Return a list of all reference extensions contained in a stanza. * If there are no reference elements, return an empty list. * * @param stanza stanza * @return list of all references contained in the stanza */ public static List<ReferenceElement> getReferencesFromStanza(Stanza stanza) { List<ReferenceElement> references = new ArrayList<>(); List<ExtensionElement> extensions = stanza.getExtensions(ReferenceElement.ELEMENT, ReferenceManager.NAMESPACE); for (ExtensionElement e : extensions) { references.add((ReferenceElement) e); } return references; }
/** * Returns the first extension of this stanza that has the given namespace. * <p> * When possible, use {@link #getExtension(String,String)} instead. * </p> * * @param namespace the namespace of the extension that is desired. * @return the stanza extension with the given namespace. */ public ExtensionElement getExtension(String namespace) { return PacketUtil.extensionElementFrom(getExtensions(), null, namespace); }
protected Stanza(Stanza p) { id = p.getStanzaId(); to = p.getTo(); from = p.getFrom(); error = p.error; // Copy extensions for (ExtensionElement pe : p.getExtensions()) { addExtension(pe); } }