Class MoodElement
- java.lang.Object
-
- org.jivesoftware.smackx.mood.element.MoodElement
-
- All Implemented Interfaces:
Element,ExtensionElement,FullyQualifiedElement,NamedElement,XmlLangElement
public class MoodElement extends java.lang.Object implements ExtensionElement
ExtensionElementthat contains the users mood. Optionally this element also contains a text node, which contains a natural language description or reason for the mood.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classMoodElement.MoodSubjectElementNamedElementwhich represents the mood.
-
Constructor Summary
Constructors Constructor Description MoodElement(MoodElement.MoodSubjectElement mood, java.lang.String text)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static MoodElementfromMessage(Message message)Extract aMoodElementfrom a message.java.lang.StringgetElementName()Returns the root element name.MoodgetMood()Return the senders mood.MoodConcretisationgetMoodConcretisation()Implementors might implement custom concretisations of mood.java.lang.StringgetNamespace()Returns the root element XML namespace.java.lang.StringgetText()The user might set a reason or description for/of their mood.booleanhasConcretisation()Return true, if this mood has a concretisation.static booleanhasMoodElement(Message message)Return true, if themessagehas aMoodElement, otherwise false.booleanhasText()Returns true, if the user gives a reason for their mood.XmlStringBuildertoXML(XmlEnvironment xmlEnvironment)-
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
-
NAMESPACE
public static final java.lang.String NAMESPACE
- See Also:
- Constant Field Values
-
ELEMENT
public static final java.lang.String ELEMENT
- See Also:
- Constant Field Values
-
QNAME
public static final javax.xml.namespace.QName QNAME
-
ELEM_TEXT
public static final java.lang.String ELEM_TEXT
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
MoodElement
public MoodElement(MoodElement.MoodSubjectElement mood, java.lang.String text)
-
-
Method Detail
-
getMood
public Mood getMood()
Return the senders mood. This method returns null in case the sender wants to stop sending their mood.- Returns:
- mood or null
-
getText
public java.lang.String getText()
The user might set a reason or description for/of their mood. This method returns a natural language reason for the mood.- Returns:
- text or null.
-
hasText
public boolean hasText()
Returns true, if the user gives a reason for their mood.- Returns:
- true or false
-
getMoodConcretisation
public MoodConcretisation getMoodConcretisation()
Implementors might implement custom concretisations of mood. This method returns any custom concretisation of the mood the user might have set.- Returns:
- concretisation or null.
-
hasConcretisation
public boolean hasConcretisation()
Return true, if this mood has a concretisation.- Returns:
- true or false
-
getNamespace
public java.lang.String getNamespace()
Description copied from interface:FullyQualifiedElementReturns the root element XML namespace.- Specified by:
getNamespacein interfaceFullyQualifiedElement- Returns:
- the namespace.
-
getElementName
public java.lang.String getElementName()
Description copied from interface:NamedElementReturns the root element name.- Specified by:
getElementNamein interfaceNamedElement- Returns:
- the element name.
-
toXML
public XmlStringBuilder toXML(XmlEnvironment xmlEnvironment)
-
fromMessage
public static MoodElement fromMessage(Message message)
Extract aMoodElementfrom a message.- Parameters:
message- message- Returns:
MoodElementor null.
-
hasMoodElement
public static boolean hasMoodElement(Message message)
Return true, if themessagehas aMoodElement, otherwise false.- Parameters:
message- message- Returns:
- true of false
-
-