Class AbstractJid

    • Field Detail

      • cache

        protected String cache
        Cache for the String representation of this JID.
    • Method Detail

      • isEntityBareJid

        public final boolean isEntityBareJid()
        Description copied from interface: Jid
        Check if this is an instance of EntityBareJid.
        Specified by:
        isEntityBareJid in interface Jid
        Returns:
        true if this is an instance of EntityBareJid
      • isEntityFullJid

        public final boolean isEntityFullJid()
        Description copied from interface: Jid
        Check if this is an instance of EntityFullJid.
        Specified by:
        isEntityFullJid in interface Jid
        Returns:
        true if this is an instance of EntityFullJid
      • isDomainBareJid

        public final boolean isDomainBareJid()
        Description copied from interface: Jid
        Check if this is an instance of DomainBareJid.
        Specified by:
        isDomainBareJid in interface Jid
        Returns:
        true if this is an instance of DomainBareJid
      • isDomainFullJid

        public final boolean isDomainFullJid()
        Description copied from interface: Jid
        Check if this is an instance of DomainFullJid.
        Specified by:
        isDomainFullJid in interface Jid
        Returns:
        true if this is an instance of DomainFullJid
      • hasResource

        public final boolean hasResource()
        Description copied from interface: Jid
        Check if this is a Jid with a Resourcepart.
        Specified by:
        hasResource in interface Jid
        Returns:
        true if this Jid has a resourcepart.
      • hasLocalpart

        public final boolean hasLocalpart()
        Description copied from interface: Jid
        Check if this is a Jid with a Localpart.
        Specified by:
        hasLocalpart in interface Jid
        Returns:
        true if this Jid has a localpart.
      • downcast

        public final <T extends Jid> T downcast​(Class<T> jidClass)
        Description copied from interface: Jid
        Return the downcasted instance of this Jid. This method is unsafe, make sure to check that this is actually of the type of are casting to.
        Specified by:
        downcast in interface Jid
        Type Parameters:
        T - the Jid type to downcast to.
        Parameters:
        jidClass - the class of JID to downcast too.
        Returns:
        the downcasted instanced of this
      • getResourceOrNull

        public abstract Resourcepart getResourceOrNull()
        Description copied from interface: Jid
        Get the resourcepart of this JID or null.

        If the JID is of form <localpart@domain.example/resource> then this method returns 'resource'. If the JID no resourcepart, then null is returned.

        Specified by:
        getResourceOrNull in interface Jid
        Returns:
        the resource of this JID or null.
      • getResourceOrEmpty

        public final Resourcepart getResourceOrEmpty()
        Description copied from interface: Jid
        Get the resourcepart of this JID or return the empty resourcepart.

        If the JID is of form <localpart@domain.example/resource> then this method returns 'resource'. If the JID no resourcepart, then Resourcepart.EMPTY is returned.

        Specified by:
        getResourceOrEmpty in interface Jid
        Returns:
        the resource of this JID or the empty resourcepart.
      • getResourceOrThrow

        public final Resourcepart getResourceOrThrow()
        Description copied from interface: Jid
        Get the resourcepart of this JID or throw an IllegalStateException.

        If the JID is of form <localpart@domain.example/resource> then this method returns 'resource'. If the JID no resourcepart, then an IllegalStateException is thrown.

        Specified by:
        getResourceOrThrow in interface Jid
        Returns:
        the resource of this JID.
      • getLocalpartOrNull

        public abstract Localpart getLocalpartOrNull()
        Description copied from interface: Jid
        Get the localpart of this JID or null.

        If the JID is of form <localpart@domain.example> then this method returns 'localpart'. If the JID has no localpart, then null is returned.

        Specified by:
        getLocalpartOrNull in interface Jid
        Returns:
        the localpart of this JID or null.
      • getLocalpartOrThrow

        public final Localpart getLocalpartOrThrow()
        Description copied from interface: Jid
        Get the localpart of this JID or throw an IllegalStateException.

        If the JID is of form <localpart@domain.example> then this method returns 'localpart'. If the JID has no localpart, then null is returned.

        Specified by:
        getLocalpartOrThrow in interface Jid
        Returns:
        the localpart of this JID.
      • isParentOf

        public final boolean isParentOf​(Jid jid)
        Description copied from interface: Jid
        Check if this JID is the parent of another JID. The parent of relation is defined, under the precondition that the JID parts (localpart, domainpart and resourcepart) are equal, as follows:
         | this JID (parentOf) | other JID           | result |
         |---------------------+---------------------+--------|
         | dom.example         | dom.example         | true   |
         | dom.example         | dom.example/res     | true   |
         | dom.example         | loc@dom.example     | true   |
         | dom.example         | loc@dom.example/res | true   |
         | dom.example/res     | dom.exmple          | false  |
         | dom.example/res     | dom.example/res     | true   |
         | dom.example/res     | loc@dom.example     | false  |
         | dom.example/res     | loc@dom.example/res | false  |
         | loc@dom.example     | dom.example         | false  |
         | loc@dom.example     | dom.example/res     | false  |
         | loc@dom.example     | loc@dom.example     | true   |
         | loc@dom.example     | loc@dom.example/res | true   |
         | loc@dom.example/res | dom.example         | false  |
         | loc@dom.example/res | dom.example/res     | false  |
         | loc@dom.example/res | loc@dom.example     | false  |
         | loc@dom.example/res | loc@dom.example/res | true   |
         
        Specified by:
        isParentOf in interface Jid
        Parameters:
        jid - the other JID to compare with
        Returns:
        true if this JID is a parent of the given JID.
      • equals

        public final boolean equals​(CharSequence charSequence)
        Description copied from interface: Jid
        Compares the given CharSequence with this JID. Returns true if equals(charSequence.toString() would return true.
        Specified by:
        equals in interface Jid
        Parameters:
        charSequence - the CharSequence to compare this JID with.
        Returns:
        true if if equals(charSequence.toString() would return true.
        See Also:
        Jid.equals(String)
      • equals

        public final boolean equals​(String string)
        Description copied from interface: Jid
        Compares the given String wit this JID.

        Returns true if toString().equals(string), that is if the String representation of this JID matches the given string.

        Specified by:
        equals in interface Jid
        Parameters:
        string - the String to compare this JID with.
        Returns:
        true if toString().equals(string).
      • intern

        public final String intern()
        Description copied from interface: Jid
        Returns the canonical String representation of this JID. See String.intern() for details.
        Specified by:
        intern in interface Jid
        Returns:
        the canonical String representation.
      • asUrlEncodedString

        public final String asUrlEncodedString()
        Description copied from interface: Jid
        Get the URL encoded version of this JID.
        Specified by:
        asUrlEncodedString in interface Jid
        Returns:
        the URL encoded version of this JID.