Class ExtensibleStanza

    • 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