Class FasteningElement
- java.lang.Object
-
- org.jivesoftware.smackx.message_fastening.element.FasteningElement
-
- All Implemented Interfaces:
Element
,ExtensionElement
,FullyQualifiedElement
,NamedElement
,XmlLangElement
public final class FasteningElement extends Object implements ExtensionElement
Message Fastening container element.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
FasteningElement.Builder
-
Field Summary
Fields Modifier and Type Field Description static String
ATTR_CLEAR
static String
ATTR_ID
static String
ATTR_SHELL
static String
ELEMENT
static String
NAMESPACE
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
applyTo(MessageBuilder messageBuilder)
Add this element to the provided message builder.static FasteningElement.Builder
builder()
static FasteningElement
createShellElementForSensitiveElement(String originIdOfSensitiveElement)
static FasteningElement
createShellElementForSensitiveElement(FasteningElement sensitiveElement)
static FasteningElement
createShellElementForSensitiveElement(OriginIdElement originIdOfSensitiveElement)
String
getElementName()
Returns the root element name.List<ExternalElement>
getExternalPayloads()
Return all external payloads of this element.String
getNamespace()
Returns the root element XML namespace.OriginIdElement
getReferencedStanzasOriginId()
List<ExtensionElement>
getWrappedPayloads()
Return all wrapped payloads of this element.static boolean
hasFasteningElement(Message message)
Return true if the providedMessage
contains aFasteningElement
.static boolean
hasFasteningElement(MessageBuilder builder)
Return true if the providedMessageBuilder
contains aFasteningElement
.boolean
isRemovingElement()
Does this element remove a previously sentFasteningElement
?boolean
isShellElement()
Is this a shell element? Shell elements are otherwise empty elements that indicate that an encrypted payload of a message encrypted using XEP-420: Stanza Content Encryption contains a sensitiveFasteningElement
.XmlStringBuilder
toXML(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
-
ELEMENT
public static final String ELEMENT
- See Also:
- Constant Field Values
-
NAMESPACE
public static final String NAMESPACE
- See Also:
- Constant Field Values
-
ATTR_ID
public static final String ATTR_ID
- See Also:
- Constant Field Values
-
ATTR_CLEAR
public static final String ATTR_CLEAR
- See Also:
- Constant Field Values
-
ATTR_SHELL
public static final String ATTR_SHELL
- See Also:
- Constant Field Values
-
-
Method Detail
-
getReferencedStanzasOriginId
public OriginIdElement getReferencedStanzasOriginId()
- Returns:
- origin id of the referenced stanza
-
getWrappedPayloads
public List<ExtensionElement> getWrappedPayloads()
Return all wrapped payloads of this element.- Returns:
- wrapped payloads.
- See Also:
- XEP-0422: §3.1. Wrapped Payloads
-
getExternalPayloads
public List<ExternalElement> getExternalPayloads()
Return all external payloads of this element.- Returns:
- external payloads.
- See Also:
- XEP-0422: §3.2. External Payloads
-
isRemovingElement
public boolean isRemovingElement()
Does this element remove a previously sentFasteningElement
?- Returns:
- true if the clear attribute is set.
- See Also:
- XEP-0422: Message Fastening §3.4 Removing fastenings
-
isShellElement
public boolean isShellElement()
Is this a shell element? Shell elements are otherwise empty elements that indicate that an encrypted payload of a message encrypted using XEP-420: Stanza Content Encryption contains a sensitiveFasteningElement
.- Returns:
- true if this is a shell element.
- See Also:
- XEP-0422: Message Fastening §3.5 Interaction with stanza encryption
-
hasFasteningElement
public static boolean hasFasteningElement(Message message)
Return true if the providedMessage
contains aFasteningElement
.- Parameters:
message
- message- Returns:
- true if the stanza has an
FasteningElement
.
-
hasFasteningElement
public static boolean hasFasteningElement(MessageBuilder builder)
Return true if the providedMessageBuilder
contains aFasteningElement
.- Parameters:
builder
- message builder- Returns:
- true if the stanza has an
FasteningElement
.
-
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 XmlStringBuilder toXML(XmlEnvironment xmlEnvironment)
-
createShellElementForSensitiveElement
public static FasteningElement createShellElementForSensitiveElement(FasteningElement sensitiveElement)
-
createShellElementForSensitiveElement
public static FasteningElement createShellElementForSensitiveElement(String originIdOfSensitiveElement)
-
createShellElementForSensitiveElement
public static FasteningElement createShellElementForSensitiveElement(OriginIdElement originIdOfSensitiveElement)
-
applyTo
public void applyTo(MessageBuilder messageBuilder)
Add this element to the provided message builder. Note: The stanza MUST NOT contain more than one apply-to elements at the same time.- Parameters:
messageBuilder
- message builder- See Also:
- XEP-0422 §4: Business Rules
-
builder
public static FasteningElement.Builder builder()
-
-