Class ExplicitMessageEncryptionElement
- java.lang.Object
-
- org.jivesoftware.smackx.eme.element.ExplicitMessageEncryptionElement
-
- All Implemented Interfaces:
Element
,ExtensionElement
,FullyQualifiedElement
,NamedElement
,XmlLangElement
public class ExplicitMessageEncryptionElement extends Object implements ExtensionElement
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ExplicitMessageEncryptionElement.ExplicitMessageEncryptionProtocol
-
Constructor Summary
Constructors Constructor Description ExplicitMessageEncryptionElement(String encryptionNamespace)
ExplicitMessageEncryptionElement(String encryptionNamespace, 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)
String
getElementName()
Returns the root element name.String
getEncryptionNamespace()
String
getName()
Get the optional name of the encryption method.String
getNamespace()
Returns the root element XML namespace.ExplicitMessageEncryptionElement.ExplicitMessageEncryptionProtocol
getProtocol()
static boolean
hasProtocol(MessageView message, 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 String ELEMENT
- See Also:
- Constant Field Values
-
NAMESPACE
public static final String NAMESPACE
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ExplicitMessageEncryptionElement
public ExplicitMessageEncryptionElement(ExplicitMessageEncryptionElement.ExplicitMessageEncryptionProtocol protocol)
-
ExplicitMessageEncryptionElement
public ExplicitMessageEncryptionElement(String encryptionNamespace)
-
ExplicitMessageEncryptionElement
public ExplicitMessageEncryptionElement(String encryptionNamespace, String name)
-
-
Method Detail
-
getProtocol
public ExplicitMessageEncryptionElement.ExplicitMessageEncryptionProtocol getProtocol()
-
getEncryptionNamespace
public String getEncryptionNamespace()
-
getName
public String getName()
Get the optional name of the encryption method.- Returns:
- the name of the encryption method or
null
.
-
getElementName
public String getElementName()
Description copied from interface:NamedElement
Returns the root element name.- Specified by:
getElementName
in interfaceNamedElement
- Returns:
- the element name.
-
getNamespace
public 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, 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
-
-