Class Forwarded<S extends Stanza>
- java.lang.Object
-
- org.jivesoftware.smackx.forward.packet.Forwarded<S>
-
- All Implemented Interfaces:
Element
,ExtensionElement
,FullyQualifiedElement
,NamedElement
,XmlLangElement
public class Forwarded<S extends Stanza> extends java.lang.Object implements ExtensionElement
Stanza extension for XEP-0297: Stanza Forwarding.- See Also:
- XEP-0297: Stanza Forwarding
-
-
Constructor Summary
Constructors Constructor Description Forwarded(DelayInformation delay, S forwardedStanza)
Deprecated.useForwarded(Stanza, DelayInformation)
instead.Forwarded(S fwdPacket)
Creates a new Forwarded stanza extension.Forwarded(S forwardedStanza, DelayInformation delay)
Creates a new Forwarded stanza extension.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static java.util.List<Message>
extractMessagesFrom(java.util.Collection<Forwarded<Message>> forwardedCollection)
Extract messages in a collection of forwarded elements.static Forwarded<?>
from(Stanza packet)
Get the forwarded extension.DelayInformation
getDelayInformation()
get the timestamp of the forwarded packet.java.lang.String
getElementName()
Returns the root element name.S
getForwardedStanza()
Get the forwarded Stanza found in this extension.java.lang.String
getNamespace()
Returns the root element XML namespace.boolean
isForwarded(java.lang.Class<? extends Stanza> stanzaClass)
Check if this is forwarding a stanza of the provided class.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
-
NAMESPACE
public static final java.lang.String NAMESPACE
- See Also:
- Constant Field Values
-
ELEMENT
public static final java.lang.String ELEMENT
- See Also:
- Constant Field Values
-
QNAME
public static final javax.xml.namespace.QName QNAME
-
-
Constructor Detail
-
Forwarded
@Deprecated public Forwarded(DelayInformation delay, S forwardedStanza)
Deprecated.useForwarded(Stanza, DelayInformation)
instead.Creates a new Forwarded stanza extension.- Parameters:
delay
- an optionalDelayInformation
timestamp of the packet.forwardedStanza
- the stanza that is forwarded (required).
-
Forwarded
public Forwarded(S fwdPacket)
Creates a new Forwarded stanza extension.- Parameters:
fwdPacket
- the stanza that is forwarded (required).
-
Forwarded
public Forwarded(S forwardedStanza, DelayInformation delay)
Creates a new Forwarded stanza extension.- Parameters:
forwardedStanza
- the stanza that is forwarded (required).delay
- an optionalDelayInformation
timestamp of the packet.
-
-
Method Detail
-
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)
-
getForwardedStanza
public S getForwardedStanza()
Get the forwarded Stanza found in this extension.- Returns:
- the
Stanza
(typically a message) that was forwarded.
-
getDelayInformation
public DelayInformation getDelayInformation()
get the timestamp of the forwarded packet.- Returns:
- the
DelayInformation
representing the time when the original stanza was sent. May be null.
-
isForwarded
public boolean isForwarded(java.lang.Class<? extends Stanza> stanzaClass)
Check if this is forwarding a stanza of the provided class.- Parameters:
stanzaClass
- the class to check for.- Returns:
true
if this is forwarding a stanza of the provided class.- Since:
- 4.4
-
from
public static Forwarded<?> from(Stanza packet)
Get the forwarded extension.- Parameters:
packet
- TODO javadoc me please- Returns:
- the Forwarded extension or null
-
extractMessagesFrom
public static java.util.List<Message> extractMessagesFrom(java.util.Collection<Forwarded<Message>> forwardedCollection)
Extract messages in a collection of forwarded elements. Note that it is required that theForwarded
in the given collection only containMessage
stanzas.- Parameters:
forwardedCollection
- the collection to extract from.- Returns:
- a list a the extracted messages.
- Since:
- 4.3.0
-
-