Class SpoilerElement
java.lang.Object
org.jivesoftware.smackx.spoiler.element.SpoilerElement
- All Implemented Interfaces:
Element
,ExtensionElement
,NamedElement
,XmlElement
,XmlLangElement
-
Field Summary
-
Constructor Summary
ConstructorDescriptionSpoilerElement
(String language, String hint) Create a new SpoilerElement with a hint about a content and a language attribute. -
Method Summary
Modifier and TypeMethodDescriptionstatic void
addSpoiler
(Message message) Add a SpoilerElement to a message.static void
addSpoiler
(Message message, String hint) Add a SpoilerElement with a hint to a message.static void
addSpoiler
(Message message, String lang, String hint) Add a SpoilerElement with a hint in a certain language to a message.static boolean
containsSpoiler
(Message message) Returns true, if the message has at least one spoiler element.Returns the root element name.getHint()
Return the hint text of the spoiler.Returns the xml:lang of this XML element, or null if one has not been set.Returns the root element XML namespace.getSpoilers
(Message message) Return a map of all spoilers contained in a message.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.XmlElement
getQName
-
Field Details
-
ELEMENT
- See Also:
-
NAMESPACE
- See Also:
-
QNAME
-
EMPTY
-
-
Constructor Details
-
SpoilerElement
Create a new SpoilerElement with a hint about a content and a language attribute.- Parameters:
language
- language of the hint.hint
- hint about the content.
-
-
Method Details
-
getHint
Return the hint text of the spoiler. May be null.- Returns:
- hint text
-
addSpoiler
Add a SpoilerElement to a message.- Parameters:
message
- message to add the Spoiler to.
-
addSpoiler
Add a SpoilerElement with a hint to a message.- Parameters:
message
- Message to add the Spoiler to.hint
- Hint about the Spoilers content.
-
addSpoiler
Add a SpoilerElement with a hint in a certain language to a message.- Parameters:
message
- Message to add the Spoiler to.lang
- language of the Spoiler hint.hint
- hint.
-
containsSpoiler
Returns true, if the message has at least one spoiler element.- Parameters:
message
- message- Returns:
- true if message has spoiler extension
-
getSpoilers
Return a map of all spoilers contained in a message. The map uses the language of a spoiler as key. If a spoiler has no language attribute, its key will be an empty String.- Parameters:
message
- message- Returns:
- map of spoilers
-
getLanguage
Description copied from interface:XmlLangElement
Returns the xml:lang of this XML element, or null if one has not been set.- Specified by:
getLanguage
in interfaceXmlElement
- Specified by:
getLanguage
in interfaceXmlLangElement
- Returns:
- the xml:lang of this XML element, or null.
-
getNamespace
Description copied from interface:XmlElement
Returns the root element XML namespace.- Specified by:
getNamespace
in interfaceXmlElement
- Returns:
- the namespace.
-
getElementName
Description copied from interface:NamedElement
Returns the root element name.- Specified by:
getElementName
in interfaceNamedElement
- Returns:
- the element name.
-
toXML
-