Modifier and Type | Class and Description |
---|---|
static class |
JidUtil.NotAEntityBareJidStringException |
Constructor and Description |
---|
JidUtil() |
Modifier and Type | Method and Description |
---|---|
static Set<EntityBareJid> |
entityBareJidSetFrom(Collection<? extends CharSequence> jidStrings)
Convert the given collection of CharSequences to bare JIDs.
|
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. |
static void |
filterDomainFullJid(Collection<? extends Jid> in,
Collection<? super DomainFullJid> out)
Filter all domain full JIDs.
|
static List<DomainFullJid> |
filterDomainFullJidList(Collection<? extends Jid> input)
Filter all domain full JIDs.
|
static Set<DomainFullJid> |
filterDomainFullJidSet(Collection<? extends Jid> input)
Filter all domain full JIDs.
|
static void |
filterEntityBareJid(Collection<? extends Jid> in,
Collection<? super EntityBareJid> out)
Filter all entity bare JIDs.
|
static List<EntityBareJid> |
filterEntityBareJidList(Collection<? extends Jid> input)
Filter all entity bare JIDs.
|
static Set<EntityBareJid> |
filterEntityBareJidSet(Collection<? extends Jid> input)
Filter all entity bare JIDs.
|
static void |
filterEntityFullJid(Collection<? extends Jid> in,
Collection<? super EntityFullJid> out)
Filter all entity full JIDs.
|
static List<EntityFullJid> |
filterEntityFullJidList(Collection<? extends Jid> input)
Filter all full JIDs.
|
static Set<EntityFullJid> |
filterEntityFullJidSet(Collection<? extends Jid> input)
Filter all full JIDs.
|
static boolean |
isTypicalValidEntityBareJid(CharSequence jid)
Check if the given CharSequence represents a typical and valid entity bare JID.
|
static boolean |
isValidEntityBareJid(CharSequence jid)
Check if the given CharSequence represents a valid entity bare JID.
|
static Set<Jid> |
jidSetFrom(Collection<? extends CharSequence> jidStrings)
Convert the given collection of CharSequences to JIDs.
|
static Set<Jid> |
jidSetFrom(String[] jids)
Convert the given array of Strings to JIDs.
|
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. |
static List<String> |
toStringList(Collection<? extends Jid> jids)
Convert a collection of JIDs to a list of Strings representing those JIDs.
|
static void |
toStrings(Collection<? extends Jid> jids,
Collection<? super String> jidStrings)
Convert a collection of JIDs to a Collection of Strings.
|
static Set<String> |
toStringSet(Collection<? extends Jid> jids)
convert a collection of JIDs to a set of Strings representing those JIDs.
|
static EntityBareJid |
validateEntityBareJid(CharSequence jidcs)
Check if the given CharSequence is a valid entity bare JID.
|
static EntityBareJid |
validateTypicalEntityBareJid(CharSequence jidcs)
Check if the given CharSequence is a typical and valid entity bare JID.
|
public JidUtil()
public static boolean isTypicalValidEntityBareJid(CharSequence jid)
isValidEntityBareJid(CharSequence)
and additionally verifies that the domainpart of the JID
contains at least one dot ('.') character.
For more information about the different verification methods see validateEntityBareJid(CharSequence)
.
jid
- the CharSequence to check.isValidEntityBareJid(CharSequence)
,
EntityBareJid
public static EntityBareJid validateTypicalEntityBareJid(CharSequence jidcs) throws JidUtil.NotAEntityBareJidStringException, XmppStringprepException
isValidEntityBareJid(CharSequence)
and additionally verifies that the domainpart of the JID
contains at least one dot ('.') character.
The …TypicalValidEntityBareJid(CharSequence)
methods are useful if you expect your users to always
enter a FQDN as domainpart. Whereas isValidEntityBareJid(CharSequence)
and
validateEntityBareJid
accept also inputs like "foo@example", the "is typical JID" methods require
the domainpart to contain a dot, e.g. "foo@example.org".
jidcs
- the JID CharSequenceJidUtil.NotAEntityBareJidStringException
- if the given CharSequence is not a bare JID.XmppStringprepException
- if an error happens.public static boolean isValidEntityBareJid(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.EntityBareJid
public static EntityBareJid validateEntityBareJid(CharSequence jidcs) throws JidUtil.NotAEntityBareJidStringException, 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.NotAEntityBareJidStringException
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.NotAEntityBareJidStringException
- if the given CharSequence is not a bare JID.XmppStringprepException
- if an error happens.public static void filterEntityBareJid(Collection<? extends Jid> in, Collection<? super EntityBareJid> out)
in
- the input collection.out
- the collection where the filtered JIDs are added to.public static Set<EntityBareJid> filterEntityBareJidSet(Collection<? extends Jid> input)
input
- the input collection.public static List<EntityBareJid> filterEntityBareJidList(Collection<? extends Jid> input)
input
- the input collection.public static void filterEntityFullJid(Collection<? extends Jid> in, Collection<? super EntityFullJid> out)
in
- the input collection.out
- the collection where the filtered JIDs are added to.public static Set<EntityFullJid> filterEntityFullJidSet(Collection<? extends Jid> input)
input
- the input collection.public static List<EntityFullJid> filterEntityFullJidList(Collection<? extends Jid> input)
input
- the input collection.public static void filterDomainFullJid(Collection<? extends Jid> in, Collection<? super DomainFullJid> out)
in
- the input collection.out
- the collection where the filtered JIDs are added to.public static Set<DomainFullJid> filterDomainFullJidSet(Collection<? extends Jid> input)
input
- the input collection.public static List<DomainFullJid> filterDomainFullJidList(Collection<? extends Jid> input)
input
- the input collection.public static Set<EntityBareJid> entityBareJidSetFrom(Collection<? extends CharSequence> jidStrings)
jidStrings
- the collection of CharSequences.public static void entityBareJidsFrom(Collection<? extends CharSequence> jidStrings, Collection<? super EntityBareJid> output, List<XmppStringprepException> exceptions)
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.
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 Set<Jid> jidSetFrom(String[] jids)
Note that errors while converting the Strings will be silently ignored.
jids
- a array of JID Strings.public static Set<Jid> jidSetFrom(Collection<? extends CharSequence> jidStrings)
jidStrings
- the collection of CharSequences.public static void jidsFrom(Collection<? extends CharSequence> jidStrings, Collection<? super Jid> output, List<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 List<String> toStringList(Collection<? extends Jid> jids)
jids
- a collection of JIDs.public static Set<String> toStringSet(Collection<? extends Jid> jids)
jids
- a collection of JIDs.public static void toStrings(Collection<? extends Jid> jids, Collection<? super String> jidStrings)
jids
- the collection of Strings to convert.jidStrings
- the collection of Strings to append to.