Class ReferenceElement
- java.lang.Object
-
- org.jivesoftware.smackx.reference.element.ReferenceElement
-
- All Implemented Interfaces:
Element
,ExtensionElement
,FullyQualifiedElement
,NamedElement
,XmlLangElement
public class ReferenceElement extends java.lang.Object implements ExtensionElement
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ReferenceElement.Type
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
ATTR_ANCHOR
static java.lang.String
ATTR_BEGIN
static java.lang.String
ATTR_END
static java.lang.String
ATTR_TYPE
static java.lang.String
ATTR_URI
static java.lang.String
ELEMENT
-
Constructor Summary
Constructors Constructor Description ReferenceElement(java.lang.Integer begin, java.lang.Integer end, ReferenceElement.Type type, java.lang.String anchor, java.net.URI uri)
XEP-Compliant constructor.ReferenceElement(java.lang.Integer begin, java.lang.Integer end, ReferenceElement.Type type, java.lang.String anchor, java.net.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 void
addMention(Stanza stanza, int begin, int end, BareJid jid)
Add a reference to another users bare jid to a stanza.static boolean
containsReferences(Stanza stanza)
Return true, if the stanza contains at least one reference extension.java.lang.String
getAnchor()
java.lang.Integer
getBegin()
java.lang.String
getElementName()
Returns the root element name.java.lang.Integer
getEnd()
java.lang.String
getNamespace()
Returns the root element XML namespace.static java.util.List<ReferenceElement>
getReferencesFromStanza(Stanza stanza)
Return a list of all reference extensions contained in a stanza.ReferenceElement.Type
getType()
java.net.URI
getUri()
XmlStringBuilder
toXML(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 java.lang.String ELEMENT
- See Also:
- Constant Field Values
-
ATTR_BEGIN
public static final java.lang.String ATTR_BEGIN
- See Also:
- Constant Field Values
-
ATTR_END
public static final java.lang.String ATTR_END
- See Also:
- Constant Field Values
-
ATTR_TYPE
public static final java.lang.String ATTR_TYPE
- See Also:
- Constant Field Values
-
ATTR_ANCHOR
public static final java.lang.String ATTR_ANCHOR
- See Also:
- Constant Field Values
-
ATTR_URI
public static final java.lang.String ATTR_URI
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ReferenceElement
public ReferenceElement(java.lang.Integer begin, java.lang.Integer end, ReferenceElement.Type type, java.lang.String anchor, java.net.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(java.lang.Integer begin, java.lang.Integer end, ReferenceElement.Type type, java.lang.String anchor, java.net.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
-
getBegin
public java.lang.Integer getBegin()
-
getEnd
public java.lang.Integer getEnd()
-
getType
public ReferenceElement.Type getType()
-
getAnchor
public java.lang.String getAnchor()
-
getUri
public java.net.URI getUri()
-
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 java.util.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 java.lang.String getNamespace()
Description copied from interface:FullyQualifiedElement
Returns the root element XML namespace.- Specified by:
getNamespace
in interfaceFullyQualifiedElement
- Returns:
- the namespace.
-
getElementName
public java.lang.String getElementName()
Description copied from interface:NamedElement
Returns the root element name.- Specified by:
getElementName
in interfaceNamedElement
- Returns:
- the element name.
-
toXML
public XmlStringBuilder toXML(XmlEnvironment enclosingNamespace)
-
-