Class ExplicitMessageEncryptionElement
- java.lang.Object
-
- org.jivesoftware.smackx.eme.element.ExplicitMessageEncryptionElement
-
- All Implemented Interfaces:
Element
,ExtensionElement
,FullyQualifiedElement
,NamedElement
,XmlLangElement
public class ExplicitMessageEncryptionElement extends java.lang.Object implements ExtensionElement
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ExplicitMessageEncryptionElement.ExplicitMessageEncryptionProtocol
-
Constructor Summary
Constructors Constructor Description ExplicitMessageEncryptionElement(java.lang.String encryptionNamespace)
ExplicitMessageEncryptionElement(java.lang.String encryptionNamespace, java.lang.String name)
ExplicitMessageEncryptionElement(ExplicitMessageEncryptionElement.ExplicitMessageEncryptionProtocol protocol)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ExplicitMessageEncryptionElement
from(Message message)
java.lang.String
getElementName()
Returns the root element name.java.lang.String
getEncryptionNamespace()
java.lang.String
getName()
Get the optional name of the encryption method.java.lang.String
getNamespace()
Returns the root element XML namespace.ExplicitMessageEncryptionElement.ExplicitMessageEncryptionProtocol
getProtocol()
static boolean
hasProtocol(MessageView message, java.lang.String protocolNamespace)
Return true, if themessage
already contains an EME element with the specifiedprotocolNamespace
.static boolean
hasProtocol(MessageView message, ExplicitMessageEncryptionElement.ExplicitMessageEncryptionProtocol protocol)
Return true, if themessage
already contains an EME element with the specified protocol namespace.static void
set(MessageBuilder message, ExplicitMessageEncryptionElement.ExplicitMessageEncryptionProtocol protocol)
Add an EME element containing the specifiedprotocol
namespace to the message.XmlStringBuilder
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
getLanguage, getQName
-
-
-
-
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
-
QNAME
public static final javax.xml.namespace.QName QNAME
-
-
Constructor Detail
-
ExplicitMessageEncryptionElement
public ExplicitMessageEncryptionElement(ExplicitMessageEncryptionElement.ExplicitMessageEncryptionProtocol protocol)
-
ExplicitMessageEncryptionElement
public ExplicitMessageEncryptionElement(java.lang.String encryptionNamespace)
-
ExplicitMessageEncryptionElement
public ExplicitMessageEncryptionElement(java.lang.String encryptionNamespace, java.lang.String name)
-
-
Method Detail
-
getProtocol
public ExplicitMessageEncryptionElement.ExplicitMessageEncryptionProtocol getProtocol()
-
getEncryptionNamespace
public java.lang.String getEncryptionNamespace()
-
getName
public java.lang.String getName()
Get the optional name of the encryption method.- Returns:
- the name of the encryption method or
null
.
-
getElementName
public java.lang.String getElementName()
Description copied from interface:NamedElement
Returns the root element name.- Specified by:
getElementName
in interfaceNamedElement
- Returns:
- the element name.
-
getNamespace
public java.lang.String getNamespace()
Description copied from interface:FullyQualifiedElement
Returns the root element XML namespace.- Specified by:
getNamespace
in interfaceFullyQualifiedElement
- Returns:
- the namespace.
-
toXML
public XmlStringBuilder toXML(XmlEnvironment enclosingNamespace)
-
from
public static ExplicitMessageEncryptionElement from(Message message)
-
hasProtocol
public static boolean hasProtocol(MessageView message, java.lang.String protocolNamespace)
Return true, if themessage
already contains an EME element with the specifiedprotocolNamespace
.- Parameters:
message
- messageprotocolNamespace
- namespace- Returns:
- true if message has EME element for that namespace, otherwise false
-
hasProtocol
public static boolean hasProtocol(MessageView message, ExplicitMessageEncryptionElement.ExplicitMessageEncryptionProtocol protocol)
Return true, if themessage
already contains an EME element with the specified protocol namespace.- Parameters:
message
- messageprotocol
- protocol- Returns:
- true if message has EME element for that namespace, otherwise false
-
set
public static void set(MessageBuilder message, ExplicitMessageEncryptionElement.ExplicitMessageEncryptionProtocol protocol)
Add an EME element containing the specifiedprotocol
namespace to the message. In case there is already an element with that protocol, we do nothing.- Parameters:
message
- a message builder.protocol
- encryption protocol
-
-