Class SpoilerElement
- java.lang.Object
-
- org.jivesoftware.smackx.spoiler.element.SpoilerElement
-
- All Implemented Interfaces:
Element
,ExtensionElement
,FullyQualifiedElement
,NamedElement
,XmlLangElement
public class SpoilerElement extends Object implements ExtensionElement
-
-
Constructor Summary
Constructors Constructor Description SpoilerElement(String language, String hint)
Create a new SpoilerElement with a hint about a content and a language attribute.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static 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.String
getElementName()
Returns the root element name.String
getHint()
Return the hint text of the spoiler.String
getLanguage()
Returns the xml:lang of this XML element, or null if one has not been set.String
getNamespace()
Returns the root element XML namespace.static Map<String,String>
getSpoilers(Message message)
Return a map of all spoilers contained in a message.CharSequence
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
getQName
-
-
-
-
Field Detail
-
ELEMENT
public static final String ELEMENT
- See Also:
- Constant Field Values
-
NAMESPACE
public static final String NAMESPACE
- See Also:
- Constant Field Values
-
EMPTY
public static final SpoilerElement EMPTY
-
-
Constructor Detail
-
SpoilerElement
public SpoilerElement(String language, String hint)
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 Detail
-
getHint
public String getHint()
Return the hint text of the spoiler. May be null.- Returns:
- hint text
-
addSpoiler
public static void addSpoiler(Message message)
Add a SpoilerElement to a message.- Parameters:
message
- message to add the Spoiler to.
-
addSpoiler
public static void addSpoiler(Message message, String hint)
Add a SpoilerElement with a hint to a message.- Parameters:
message
- Message to add the Spoiler to.hint
- Hint about the Spoilers content.
-
addSpoiler
public static void addSpoiler(Message message, String lang, String hint)
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
public static boolean containsSpoiler(Message message)
Returns true, if the message has at least one spoiler element.- Parameters:
message
- message- Returns:
- true if message has spoiler extension
-
getSpoilers
public static Map<String,String> getSpoilers(Message message)
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
public String 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 interfaceFullyQualifiedElement
- Specified by:
getLanguage
in interfaceXmlLangElement
- Returns:
- the xml:lang of this XML element, or null.
-
getNamespace
public String getNamespace()
Description copied from interface:FullyQualifiedElement
Returns the root element XML namespace.- Specified by:
getNamespace
in interfaceFullyQualifiedElement
- Returns:
- the namespace.
-
getElementName
public String getElementName()
Description copied from interface:NamedElement
Returns the root element name.- Specified by:
getElementName
in interfaceNamedElement
- Returns:
- the element name.
-
toXML
public CharSequence toXML(XmlEnvironment enclosingNamespace)
-
-