public class SpoilerElement extends Object implements ExtensionElement
Modifier and Type | Field and Description |
---|---|
static String |
ELEMENT |
static SpoilerElement |
EMPTY |
static String |
NAMESPACE |
Constructor and Description |
---|
SpoilerElement(String language,
String hint)
Create a new SpoilerElement with a hint about a content and a language attribute.
|
Modifier and Type | Method and 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()
Return the language of the hint.
|
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(String enclosingNamespace)
Returns the XML representation of this Element.
|
public static final String ELEMENT
public static final String NAMESPACE
public static final SpoilerElement EMPTY
public SpoilerElement(String language, String hint)
language
- language of the hint.hint
- hint about the content.public String getHint()
public static void addSpoiler(Message message)
message
- message to add the Spoiler to.public static void addSpoiler(Message message, String hint)
message
- Message to add the Spoiler to.hint
- Hint about the Spoilers content.public static void addSpoiler(Message message, String lang, String hint)
message
- Message to add the Spoiler to.lang
- language of the Spoiler hint.hint
- hint.public static boolean containsSpoiler(Message message)
message
- messagepublic static Map<String,String> getSpoilers(Message message)
message
- messagepublic String getLanguage()
public String getNamespace()
ExtensionElement
getNamespace
in interface ExtensionElement
public String getElementName()
NamedElement
getElementName
in interface NamedElement
public CharSequence toXML(String enclosingNamespace)
Element