Class SpoilerElement
- java.lang.Object
-
- org.jivesoftware.smackx.spoiler.element.SpoilerElement
-
- All Implemented Interfaces:
org.jivesoftware.smack.packet.Element
,org.jivesoftware.smack.packet.ExtensionElement
,org.jivesoftware.smack.packet.FullyQualifiedElement
,org.jivesoftware.smack.packet.NamedElement
,org.jivesoftware.smack.packet.XmlLangElement
public class SpoilerElement extends java.lang.Object implements org.jivesoftware.smack.packet.ExtensionElement
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
ELEMENT
static SpoilerElement
EMPTY
static java.lang.String
NAMESPACE
-
Constructor Summary
Constructors Constructor Description SpoilerElement(java.lang.String language, java.lang.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(org.jivesoftware.smack.packet.Message message)
Add a SpoilerElement to a message.static void
addSpoiler(org.jivesoftware.smack.packet.Message message, java.lang.String hint)
Add a SpoilerElement with a hint to a message.static void
addSpoiler(org.jivesoftware.smack.packet.Message message, java.lang.String lang, java.lang.String hint)
Add a SpoilerElement with a hint in a certain language to a message.static boolean
containsSpoiler(org.jivesoftware.smack.packet.Message message)
Returns true, if the message has at least one spoiler element.java.lang.String
getElementName()
java.lang.String
getHint()
Return the hint text of the spoiler.java.lang.String
getLanguage()
java.lang.String
getNamespace()
static java.util.Map<java.lang.String,java.lang.String>
getSpoilers(org.jivesoftware.smack.packet.Message message)
Return a map of all spoilers contained in a message.java.lang.CharSequence
toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace)
-
-
-
Field Detail
-
ELEMENT
public static final java.lang.String ELEMENT
- See Also:
- Constant Field Values
-
NAMESPACE
public static final java.lang.String NAMESPACE
- See Also:
- Constant Field Values
-
EMPTY
public static final SpoilerElement EMPTY
-
-
Method Detail
-
getHint
public java.lang.String getHint()
Return the hint text of the spoiler. May be null.- Returns:
- hint text
-
addSpoiler
public static void addSpoiler(org.jivesoftware.smack.packet.Message message)
Add a SpoilerElement to a message.- Parameters:
message
- message to add the Spoiler to.
-
addSpoiler
public static void addSpoiler(org.jivesoftware.smack.packet.Message message, java.lang.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(org.jivesoftware.smack.packet.Message message, java.lang.String lang, java.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(org.jivesoftware.smack.packet.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 java.util.Map<java.lang.String,java.lang.String> getSpoilers(org.jivesoftware.smack.packet.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 java.lang.String getLanguage()
- Specified by:
getLanguage
in interfaceorg.jivesoftware.smack.packet.FullyQualifiedElement
- Specified by:
getLanguage
in interfaceorg.jivesoftware.smack.packet.XmlLangElement
-
getNamespace
public java.lang.String getNamespace()
- Specified by:
getNamespace
in interfaceorg.jivesoftware.smack.packet.FullyQualifiedElement
-
getElementName
public java.lang.String getElementName()
- Specified by:
getElementName
in interfaceorg.jivesoftware.smack.packet.NamedElement
-
toXML
public java.lang.CharSequence toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace)
- Specified by:
toXML
in interfaceorg.jivesoftware.smack.packet.Element
-
-