public class JidUtil
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static class |
JidUtil.NotABareJidStringException |
| Constructor and Description |
|---|
JidUtil() |
| Modifier and Type | Method and Description |
|---|---|
static java.util.Set<BareJid> |
bareJidSetFrom(java.util.Collection<? extends java.lang.CharSequence> jidStrings)
Convert the given collection of CharSequences to bare JIDs.
|
static void |
bareJidsFrom(java.util.Collection<? extends java.lang.CharSequence> jidStrings,
java.util.Collection<BareJid> output,
java.util.List<org.jxmpp.stringprep.XmppStringprepException> exceptions)
Convert a collection of Strings to a Set of
BareJid's. |
static void |
filterBareJid(java.util.Collection<? extends Jid> in,
java.util.Collection<BareJid> out)
Filter all bare JIDs.
|
static java.util.List<BareJid> |
filterBareJidList(java.util.Collection<? extends Jid> input)
Filter all bare JIDs.
|
static java.util.Set<BareJid> |
filterBareJidSet(java.util.Collection<? extends Jid> input)
Filter all bare JIDs.
|
static void |
filterDomainFullJid(java.util.Collection<? extends Jid> in,
java.util.Collection<DomainFullJid> out)
Filter all domain full JIDs.
|
static java.util.List<DomainFullJid> |
filterDomainFullJidList(java.util.Collection<? extends Jid> input)
Filter all domain full JIDs.
|
static java.util.Set<DomainFullJid> |
filterDomainFullJidSet(java.util.Collection<? extends Jid> input)
Filter all domain full JIDs.
|
static void |
filterFullJid(java.util.Collection<? extends Jid> in,
java.util.Collection<FullJid> out)
Filter all full JIDs.
|
static java.util.List<FullJid> |
filterFullJidList(java.util.Collection<? extends Jid> input)
Filter all full JIDs.
|
static java.util.Set<FullJid> |
filterFullJidSet(java.util.Collection<? extends Jid> input)
Filter all full JIDs.
|
static boolean |
isValidBareJid(java.lang.CharSequence jid)
Check if the given CharSequence represents a valid bare JID.
|
static java.util.Set<Jid> |
jidSetFrom(java.util.Collection<? extends java.lang.CharSequence> jidStrings)
Convert the given collection of CharSequences to JIDs.
|
static java.util.Set<Jid> |
jidSetFrom(java.lang.String[] jids)
Convert the given array of Strings to JIDs.
|
static void |
jidsFrom(java.util.Collection<? extends java.lang.CharSequence> jidStrings,
java.util.Collection<Jid> output,
java.util.List<org.jxmpp.stringprep.XmppStringprepException> exceptions)
Convert a collection of Strings to a Set of
Jid's. |
static java.util.List<java.lang.String> |
toStringList(java.util.Collection<? extends Jid> jids)
Convert a collection of JIDs to a list of Strings representing those JIDs.
|
static void |
toStrings(java.util.Collection<? extends Jid> jids,
java.util.Collection<? super java.lang.String> jidStrings)
Convert a collection of JIDs to a Collection of Strings.
|
static java.util.Set<java.lang.String> |
toStringSet(java.util.Collection<? extends Jid> jids)
convert a collection of JIDs to a set of Strings representing those JIDs.
|
static BareJid |
validateBareJid(java.lang.CharSequence jidcs)
Check if the given CharSequence is a valid bare JID.
|
public static boolean isValidBareJid(java.lang.CharSequence jid)
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.
jid - the CharSequence to check.public static BareJid validateBareJid(java.lang.CharSequence jidcs) throws JidUtil.NotABareJidStringException, org.jxmpp.stringprep.XmppStringprepException
This is a convenience method meant to validate user entered bare JIDs. If
the given jid is not a valid bare JID, then this method will
throw either JidUtil.NotABareJidStringException or
XmppStringprepException. The NotABareJidStringException will
contain a meaningful message explaining why the given CharSequence is not a
valid bare JID (e.g. "does not contain a '@' character").
jidcs - the JID CharSequenceJidUtil.NotABareJidStringException - if the given CharSequence is not a bare JID.org.jxmpp.stringprep.XmppStringprepException - if an error happens.public static void filterBareJid(java.util.Collection<? extends Jid> in, java.util.Collection<BareJid> out)
in - the input collection.out - the collection where the filtered JIDs are added to.public static java.util.Set<BareJid> filterBareJidSet(java.util.Collection<? extends Jid> input)
input - the input collection.public static java.util.List<BareJid> filterBareJidList(java.util.Collection<? extends Jid> input)
input - the input collection.public static void filterFullJid(java.util.Collection<? extends Jid> in, java.util.Collection<FullJid> out)
in - the input collection.out - the collection where the filtered JIDs are added to.public static java.util.Set<FullJid> filterFullJidSet(java.util.Collection<? extends Jid> input)
input - the input collection.public static java.util.List<FullJid> filterFullJidList(java.util.Collection<? extends Jid> input)
input - the input collection.public static void filterDomainFullJid(java.util.Collection<? extends Jid> in, java.util.Collection<DomainFullJid> out)
in - the input collection.out - the collection where the filtered JIDs are added to.public static java.util.Set<DomainFullJid> filterDomainFullJidSet(java.util.Collection<? extends Jid> input)
input - the input collection.public static java.util.List<DomainFullJid> filterDomainFullJidList(java.util.Collection<? extends Jid> input)
input - the input collection.public static java.util.Set<BareJid> bareJidSetFrom(java.util.Collection<? extends java.lang.CharSequence> jidStrings)
jidStrings - the collection of CharSequences.public static void bareJidsFrom(java.util.Collection<? extends java.lang.CharSequence> jidStrings,
java.util.Collection<BareJid> output,
java.util.List<org.jxmpp.stringprep.XmppStringprepException> exceptions)
BareJid'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.
jidStrings - the strings that are going to get convertedoutput - the collection where the BareJid's will be added toexceptions - the list of exceptions thrown while converting.public static java.util.Set<Jid> jidSetFrom(java.lang.String[] jids)
Note that errors while converting the Strings will be silently ignored.
jids - a array of JID Strings.public static java.util.Set<Jid> jidSetFrom(java.util.Collection<? extends java.lang.CharSequence> jidStrings)
jidStrings - the collection of CharSequences.public static void jidsFrom(java.util.Collection<? extends java.lang.CharSequence> jidStrings,
java.util.Collection<Jid> output,
java.util.List<org.jxmpp.stringprep.XmppStringprepException> exceptions)
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.
jidStrings - the strings that are going to get convertedoutput - the collection where the Jid's will be added toexceptions - the list of exceptions thrown while converting.public static java.util.List<java.lang.String> toStringList(java.util.Collection<? extends Jid> jids)
jids - a collection of JIDs.public static java.util.Set<java.lang.String> toStringSet(java.util.Collection<? extends Jid> jids)
jids - a collection of JIDs.public static void toStrings(java.util.Collection<? extends Jid> jids, java.util.Collection<? super java.lang.String> jidStrings)
jids - the collection of Strings to convert.jidStrings - the collection of Strings to append to.