Class JidUtil

    • Constructor Detail

    • Method Detail

      • isValidEntityBareJid

        public static boolean isValidEntityBareJid​(CharSequence jid)
        Check if the given CharSequence represents a valid entity bare JID. That is, it must consists exactly of a local- and a domainpart (<localpart@domainpart>).

        This method is meant to validate user input and give fast feedback (e.g. with a red or green light) about if the user entered CharSequence represents a bare JID.

        Parameters:
        jid - the CharSequence to check.
        Returns:
        true if @{code jid} represents a valid entity bare JID, false otherwise
        See Also:
        EntityBareJid
      • filterEntityBareJidSet

        public static Set<EntityBareJidfilterEntityBareJidSet​(Collection<? extends Jid> input)
        Filter all entity bare JIDs.
        Parameters:
        input - the input collection.
        Returns:
        a set containing all bare JIDs of the input collection.
      • filterDomainFullJidSet

        public static Set<DomainFullJidfilterDomainFullJidSet​(Collection<? extends Jid> input)
        Filter all domain full JIDs.
        Parameters:
        input - the input collection.
        Returns:
        a set containing all domain full JIDs of the input collection.
      • filterDomainFullJidList

        public static List<DomainFullJidfilterDomainFullJidList​(Collection<? extends Jid> input)
        Filter all domain full JIDs.
        Parameters:
        input - the input collection.
        Returns:
        a list containing all domain full JIDs of the input collection.
      • entityBareJidsFrom

        public static void entityBareJidsFrom​(Collection<? extends CharSequence> jidStrings,
                                              Collection<? super EntityBareJid> output,
                                              List<XmppStringprepException> exceptions)
        Convert a collection of Strings to a Set of EntityBareJid's.

        If the optional argument exceptions is given, then all XmppStringprepException thrown while converting will be added to the list. Otherwise, if an XmppStringprepExceptions is thrown, it will be wrapped in a AssertionError Exception and throw.

        Parameters:
        jidStrings - the strings that are going to get converted
        output - the collection where the BareJid's will be added to
        exceptions - the list of exceptions thrown while converting.
      • jidSetFrom

        public static Set<JidjidSetFrom​(String[] jids)
        Convert the given array of Strings to JIDs.

        Note that errors while converting the Strings will be silently ignored.

        Parameters:
        jids - a array of JID Strings.
        Returns:
        a set of JIDs.
      • jidSetFrom

        public static Set<JidjidSetFrom​(Collection<? extends CharSequence> jidStrings)
        Convert the given collection of CharSequences to JIDs.
        Parameters:
        jidStrings - the collection of CharSequences.
        Returns:
        a set of JIDs.
      • jidsFrom

        public static void jidsFrom​(Collection<? extends CharSequence> jidStrings,
                                    Collection<? super Jid> output,
                                    List<XmppStringprepException> exceptions)
        Convert a collection of Strings to a Set of Jid's.

        If the optional argument exceptions is given, then all XmppStringprepException thrown while converting will be added to the list. Otherwise, if an XmppStringprepExceptions is thrown, it will be wrapped in a AssertionError Exception and throw.

        Parameters:
        jidStrings - the strings that are going to get converted
        output - the collection where the Jid's will be added to
        exceptions - the list of exceptions thrown while converting.
      • toStringList

        public static List<StringtoStringList​(Collection<? extends Jid> jids)
        Convert a collection of JIDs to a list of Strings representing those JIDs.
        Parameters:
        jids - a collection of JIDs.
        Returns:
        a list of Strings.
      • toStringSet

        public static Set<StringtoStringSet​(Collection<? extends Jid> jids)
        convert a collection of JIDs to a set of Strings representing those JIDs.
        Parameters:
        jids - a collection of JIDs.
        Returns:
        a set of String.
      • toStrings

        public static void toStrings​(Collection<? extends Jid> jids,
                                     Collection<? super String> jidStrings)
        Convert a collection of JIDs to a Collection of Strings.
        Parameters:
        jids - the collection of Strings to convert.
        jidStrings - the collection of Strings to append to.
      • equals

        public static boolean equals​(Jid jidOne,
                                     Jid jidTwo)
        Check if two JIDs are equals. Takes null values into consideration. Which means that this method will return true if both JIDs are null.
        Parameters:
        jidOne - The first JID to compare.
        jidTwo - The second JID to compare.
        Returns:
        true if both JIDs are equals.
        Since:
        0.7.0