Class ReferenceElement
- java.lang.Object
-
- org.jivesoftware.smackx.reference.element.ReferenceElement
-
- All Implemented Interfaces:
Element,ExtensionElement,FullyQualifiedElement,NamedElement,XmlLangElement
public class ReferenceElement extends Object implements ExtensionElement
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classReferenceElement.Type
-
Constructor Summary
Constructors Constructor Description ReferenceElement(Integer begin, Integer end, ReferenceElement.Type type, String anchor, URI uri)XEP-Compliant constructor.ReferenceElement(Integer begin, Integer end, ReferenceElement.Type type, String anchor, URI uri, ExtensionElement child)XEP-incompliant (v0.2) constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static voidaddMention(Stanza stanza, int begin, int end, BareJid jid)Add a reference to another users bare jid to a stanza.static booleancontainsReferences(Stanza stanza)Return true, if the stanza contains at least one reference extension.StringgetAnchor()IntegergetBegin()StringgetElementName()Returns the root element name.IntegergetEnd()StringgetNamespace()Returns the root element XML namespace.static List<ReferenceElement>getReferencesFromStanza(Stanza stanza)Return a list of all reference extensions contained in a stanza.ReferenceElement.TypegetType()URIgetUri()XmlStringBuildertoXML(XmlEnvironment enclosingNamespace)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.jivesoftware.smack.packet.FullyQualifiedElement
getLanguage, getQName
-
-
-
-
Field Detail
-
ELEMENT
public static final String ELEMENT
- See Also:
- Constant Field Values
-
ATTR_BEGIN
public static final String ATTR_BEGIN
- See Also:
- Constant Field Values
-
ATTR_END
public static final String ATTR_END
- See Also:
- Constant Field Values
-
ATTR_TYPE
public static final String ATTR_TYPE
- See Also:
- Constant Field Values
-
ATTR_ANCHOR
public static final String ATTR_ANCHOR
- See Also:
- Constant Field Values
-
ATTR_URI
public static final String ATTR_URI
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ReferenceElement
public ReferenceElement(Integer begin, Integer end, ReferenceElement.Type type, String anchor, URI uri, ExtensionElement child)
XEP-incompliant (v0.2) constructor. This is needed for SIMS.- Parameters:
begin- TODO javadoc me pleaseend- TODO javadoc me pleasetype- TODO javadoc me pleaseanchor- TODO javadoc me pleaseuri- TODO javadoc me pleasechild- TODO javadoc me please
-
ReferenceElement
public ReferenceElement(Integer begin, Integer end, ReferenceElement.Type type, String anchor, URI uri)
XEP-Compliant constructor.- Parameters:
begin- TODO javadoc me pleaseend- TODO javadoc me pleasetype- TODO javadoc me pleaseanchor- TODO javadoc me pleaseuri- TODO javadoc me please
-
-
Method Detail
-
getType
public ReferenceElement.Type getType()
-
addMention
public static void addMention(Stanza stanza, int begin, int end, BareJid jid)
Add a reference to another users bare jid to a stanza.- Parameters:
stanza- stanza.begin- start index of the mention in the messages body.end- end index of the mention in the messages body.jid- referenced jid.
-
getReferencesFromStanza
public static List<ReferenceElement> getReferencesFromStanza(Stanza stanza)
Return a list of all reference extensions contained in a stanza. If there are no reference elements, return an empty list.- Parameters:
stanza- stanza- Returns:
- list of all references contained in the stanza
-
containsReferences
public static boolean containsReferences(Stanza stanza)
Return true, if the stanza contains at least one reference extension.- Parameters:
stanza- stanza- Returns:
- true if stanza contains references
-
getNamespace
public String getNamespace()
Description copied from interface:FullyQualifiedElementReturns the root element XML namespace.- Specified by:
getNamespacein interfaceFullyQualifiedElement- Returns:
- the namespace.
-
getElementName
public String getElementName()
Description copied from interface:NamedElementReturns the root element name.- Specified by:
getElementNamein interfaceNamedElement- Returns:
- the element name.
-
toXML
public XmlStringBuilder toXML(XmlEnvironment enclosingNamespace)
-
-