Package rocks.xmpp.core.stanza.model
Class ExtensibleStanza
- java.lang.Object
-
- rocks.xmpp.core.stanza.model.Stanza
-
- rocks.xmpp.core.stanza.model.ExtensibleStanza
-
- All Implemented Interfaces:
LanguageElement
,StreamElement
public abstract class ExtensibleStanza extends Stanza
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
addExtension(Object extension)
Adds an extension to this stanza.void
addExtensions(Object... extensions)
Adds extensions to this stanza.void
addExtensions(Collection<Object> extensions)
Adds extensions to this stanza.List<Object>
getExtensions()
Gets all extensions.<T> List<T>
getExtensions(Class<T> clazz)
Gets the extensions of the given type.void
putExtension(Object extension)
Replaces an existing extension of the same type or adds the extension, if it doesn't exist yet.boolean
removeExtension(Class<?> clazz)
Removes all extensions of the given type.-
Methods inherited from class rocks.xmpp.core.stanza.model.Stanza
createError, createError, getError, getExtension, getFrom, getId, getLanguage, getTo, hasExtension, isToItselfOrServer, setError, setFrom, setId, setLanguage, setTo, toString
-
-
-
-
Method Detail
-
addExtension
public final boolean addExtension(Object extension)
Adds an extension to this stanza.- Parameters:
extension
- The extension.- Returns:
- Whether the extension was added.
-
addExtensions
public final void addExtensions(Object... extensions)
Adds extensions to this stanza.- Parameters:
extensions
- The extensions.- Since:
- 0.8.0
-
addExtensions
public final void addExtensions(Collection<Object> extensions)
Adds extensions to this stanza.- Parameters:
extensions
- The extensions.- Since:
- 0.8.0
-
removeExtension
public final boolean removeExtension(Class<?> clazz)
Removes all extensions of the given type.- Parameters:
clazz
- The extension class.- Returns:
- Whether the extension could be removed.
-
putExtension
public final void putExtension(Object extension)
Replaces an existing extension of the same type or adds the extension, if it doesn't exist yet.This is useful, if you want to make sure, that a stanza only has one extension of a specific type.
- Parameters:
extension
- The extension.- Since:
- 0.8.0
-
getExtensions
public final List<Object> getExtensions()
Gets all extensions.- Returns:
- The extensions.
-
getExtensions
public final <T> List<T> getExtensions(Class<T> clazz)
Gets the extensions of the given type. The returned list is unmodifiable.- Type Parameters:
T
- The extension type.- Parameters:
clazz
- The extension class.- Returns:
- The unmodifiable list of extensions which are of the given type.
- Since:
- 0.8.0
-
-