Class Address

  • All Implemented Interfaces:
    Addressable

    public final class Address
    extends Object
    implements Addressable
    The implementation of the <address/> element in the http://jabber.org/protocol/address namespace.

    Usage

    To create a new address, use one of the public constructors, like:

    
     Address address = new Address(Address.Type.TO, Jid.of("hildjj@jabber.org/Work"), "description");
     

    To mark an address as delivered, create a new immutable address object from an undelivered address:

    
     Address delivered = address.delivered();
     

    This class is immutable.

    See Also:
    XEP-0033: Extended Stanza Addressing, XML Schema, Addresses
    • Constructor Detail

      • Address

        public Address​(Address.Type type,
                       Jid jid,
                       Object... extensions)
        Parameters:
        type - The address type.
        jid - Specifies a simple Jabber ID associated with this address.
        extensions - The extensions.
      • Address

        public Address​(Address.Type type,
                       Jid jid,
                       CharSequence description,
                       Object... extensions)
        Parameters:
        type - The address type.
        jid - Specifies a simple Jabber ID associated with this address.
        description - Specifies human-readable information for this address. This data may be used by clients to provide richer address-book integration.
        extensions - The extensions.
      • Address

        public Address​(Address.Type type,
                       Jid jid,
                       CharSequence description,
                       CharSequence node,
                       Object... extensions)
        Parameters:
        type - The address type.
        jid - Specifies a simple Jabber ID associated with this address.
        description - Specifies human-readable information for this address. This data may be used by clients to provide richer address-book integration.
        node - Specifies a sub-addressable unit at a particular JID, corresponding to a Service Discovery node.
        extensions - The extensions.
      • Address

        public Address​(Address.Type type,
                       URI uri,
                       CharSequence description,
                       Object... extensions)
        Parameters:
        type - The address type.
        uri - Specifies an external system address, such as a sip:, sips:, or im: URI.
        description - Specifies human-readable information for this address. This data may be used by clients to provide richer address-book integration.
        extensions - The extensions.
    • Method Detail

      • getUri

        public final URI getUri()
        Gets the URI. It specifies an external system address, such as a sip:, sips:, or im: URI.
        Returns:
        The URI.
        See Also:
        4.2 'uri' attribute
      • getNode

        public final String getNode()
        Gets the node. It specifies a sub-addressable unit at a particular JID, corresponding to a Service Discovery node.
        Returns:
        The node.
        See Also:
        4.3 'node' attribute
      • getDescription

        public final String getDescription()
        Gets the description. It specifies human-readable information for this address. This data may be used by clients to provide richer address-book integration.
        Returns:
        The description.
        See Also:
        4.4 'desc' attribute
      • isDelivered

        public final boolean isDelivered()
        Indicates, whether the service has delivered the stanza to this address.
        Returns:
        True, if the service has delivered the stanza to this address.
        See Also:
        4.5 'delivered' attribute
      • delivered

        public final Address delivered()
        Creates a copy of this address, which is marked as delivered.
        Returns:
        A new address object, marked as delivered.
      • undelivered

        public final Address undelivered()
        Creates a copy of this address, whose delivered attribute is removed.
        Returns:
        A new address object without delivered attribute.
      • getExtensions

        public final List<Object> getExtensions()
        Gets the extensions as unmodifiable list.
        Returns:
        The extensions.
        See Also:
        4.7 Extensibility
      • getExtension

        public final <T> T getExtension​(Class<T> clazz)
        Gets the extension.
        Type Parameters:
        T - The extension type.
        Parameters:
        clazz - The extension class.
        Returns:
        The extension or null.
        See Also:
        4.7 Extensibility