public class JidCreate extends Object
If the input was user generated, e.g. captured from some sort of user
interface, fromUnescaped(String)
should be used instead. This allows
the user to enter unescaped JID values. You can use
JidUtil.isValidEntityBareJid(CharSequence)
to
query, e.g. while the user it entering it, if a given CharSequence is a valid
bare JID.
JIDs created from input received from an XMPP source should use
from(String)
.
JidCreate uses caches for efficient Jid construction, But it's not guaranteed that the same String or CharSequence will yield the same Jid instance.
Jid
Constructor and Description |
---|
JidCreate() |
public JidCreate()
public static Jid from(CharSequence localpart, CharSequence domainpart, CharSequence resource) throws XmppStringprepException
Jid
from the given parts.
Only the domainpart is required.
localpart
- a optional localpart.domainpart
- a required domainpart.resource
- a optional resourcepart.XmppStringprepException
- if an error occurs.public static Jid from(String localpart, String domainpart, String resource) throws XmppStringprepException
Jid
from the given parts.
Only the domainpart is required.
localpart
- a optional localpart.domainpart
- a required domainpart.resource
- a optional resourcepart.XmppStringprepException
- if an error occurs.public static Jid fromOrThrowUnchecked(CharSequence cs)
from(CharSequence)
but does throw an unchecked IllegalArgumentException
instead of a
XmppStringprepException
.cs
- the character sequence which should be transformed to a Jid
Jid
if no exception occursIllegalArgumentException
- if the given input is not a valid JIDfrom(String)
public static Jid from(CharSequence jid) throws XmppStringprepException
Jid
from a CharSequence.jid
- the input CharSequence.XmppStringprepException
- if an error occurs.from(String)
public static Jid from(String jidString) throws XmppStringprepException
Jid
from the given String.jidString
- the input String.XmppStringprepException
- if an error occurs.from(CharSequence)
public static Jid fromOrNull(CharSequence cs)
cs
- the input CharSequence
null
public static Jid fromUnescapedOrThrowUnchecked(CharSequence cs)
fromUnescaped(CharSequence)
but does throw an unchecked IllegalArgumentException
instead of a
XmppStringprepException
.cs
- the character sequence which should be transformed to a Jid
Jid
if no exception occursIllegalArgumentException
- if the given input is not a valid JIDfromUnescaped(CharSequence)
public static Jid fromUnescaped(CharSequence unescapedJid) throws XmppStringprepException
Jid
from the given unescaped CharSequence.unescapedJid
- an unescaped CharSequence representing a JID.XmppStringprepException
- if an error occurs.public static Jid fromUnescaped(String unescapedJidString) throws XmppStringprepException
Jid
from the given unescaped String.unescapedJidString
- a unescaped String representing a JID.XmppStringprepException
- if an error occurs.public static Jid fromUnescapedOrNull(CharSequence cs)
cs
- the input CharSequence
null
public static BareJid bareFromOrThrowUnchecked(CharSequence cs)
bareFrom(CharSequence)
but does throw an unchecked IllegalArgumentException
instead of a
XmppStringprepException
.cs
- the character sequence which should be transformed to a BareJid
BareJid
if no exception occursIllegalArgumentException
- if the given input is not a valid JIDbareFrom(CharSequence)
public static BareJid bareFrom(CharSequence jid) throws XmppStringprepException
BareJid
representing the given CharSequence.jid
- the input CharSequence.XmppStringprepException
- if an error occurs.public static BareJid bareFrom(String jid) throws XmppStringprepException
BareJid
representing the given String.jid
- the input String.XmppStringprepException
- if an error occurs.public static BareJid bareFrom(Localpart localpart, DomainBareJid domainBareJid)
localpart
- a optional localpart.domainBareJid
- a domain bare JID.public static BareJid bareFrom(Localpart localpart, Domainpart domain)
localpart
- a optional localpart.domain
- a domainpart.public static BareJid bareFromOrNull(CharSequence cs)
cs
- the input CharSequence
null
public static FullJid fullFromOrThrowUnchecked(CharSequence cs)
fullFrom(CharSequence)
but does throw an unchecked IllegalArgumentException
instead of a
XmppStringprepException
.cs
- the character sequence which should be transformed to a FullJid
FullJid
if no exception occursIllegalArgumentException
- if the given input is not a valid JIDfullFrom(CharSequence)
public static FullJid fullFrom(CharSequence jid) throws XmppStringprepException
FullJid
representing the given CharSequence.jid
- a CharSequence representing a JID.XmppStringprepException
- if an error occurs.public static FullJid fullFrom(String jid) throws XmppStringprepException
FullJid
representing the given String.jid
- the JID's String.XmppStringprepException
- if an error occurs.public static FullJid fullFrom(String localpart, String domainpart, String resource) throws XmppStringprepException
FullJid
constructed from the given parts.localpart
- a optional localpart.domainpart
- a domainpart.resource
- a resourcepart.XmppStringprepException
- if an error occurs.public static FullJid fullFrom(Localpart localpart, DomainBareJid domainBareJid, Resourcepart resource)
FullJid
constructed from the given parts.localpart
- a optional localpart.domainBareJid
- a domain bare JID.resource
- a resourcepartpublic static FullJid fullFrom(Localpart localpart, Domainpart domainpart, Resourcepart resource)
FullJid
constructed from the given parts.localpart
- the optional localpart.domainpart
- the domainpart.resource
- the resourcepart.public static FullJid fullFromOrNull(CharSequence cs)
cs
- the input CharSequence
null
public static EntityJid entityFromOrThrowUnchecked(CharSequence cs)
entityFrom(CharSequence)
but does throw an unchecked IllegalArgumentException
instead of a
XmppStringprepException
.cs
- the character sequence which should be transformed to a EntityJid
EntityJid
if no exception occursIllegalArgumentException
- if the given input is not a valid JIDentityFrom(CharSequence)
public static EntityFullJid fullFrom(EntityBareJid bareJid, Resourcepart resource)
bareJid
- a entity bare JID.resource
- a resourcepart.public static EntityJid entityFrom(CharSequence jid) throws XmppStringprepException
EntityJid
representing the given String.jid
- the JID's string.XmppStringprepException
- if an error occurs.public static EntityJid entityFrom(String jidString) throws XmppStringprepException
EntityJid
representing the given String.jidString
- the JID's string.XmppStringprepException
- if an error occurs.public static EntityJid entityFromUnescapedOrThrowUnchecked(CharSequence cs)
entityFromUnescaped(CharSequence)
but does throw an unchecked IllegalArgumentException
instead of a
XmppStringprepException
.cs
- the character sequence which should be transformed to a EntityJid
EntityJid
if no exception occursIllegalArgumentException
- if the given input is not a valid JIDentityFromUnescaped(CharSequence)
public static EntityJid entityFromUnescaped(CharSequence jid) throws XmppStringprepException
EntityJid
representing the given String.jid
- the JID.XmppStringprepException
- if an error occurs.public static EntityJid entityFromUnescaped(String jidString) throws XmppStringprepException
EntityJid
representing the given String.jidString
- the JID's string.XmppStringprepException
- if an error occurs.public static EntityJid entityFromUnesacpedOrNull(CharSequence cs)
cs
- the input CharSequence
null
public static EntityJid entityFromOrNull(CharSequence cs)
cs
- the input CharSequence
null
public static EntityBareJid entityBareFromOrThrowUnchecked(CharSequence cs)
entityBareFrom(CharSequence)
but does throw an unchecked IllegalArgumentException
instead of a
XmppStringprepException
.cs
- the character sequence which should be transformed to a EntityBareJid
EntityBareJid
if no exception occursIllegalArgumentException
- if the given input is not a valid JIDentityBareFrom(CharSequence)
public static EntityBareJid entityBareFrom(CharSequence jid) throws XmppStringprepException
EntityBareJid
representing the given CharSequence.jid
- the input CharSequence.XmppStringprepException
- if an error occurs.public static EntityBareJid entityBareFrom(String jid) throws XmppStringprepException
EntityBareJid
representing the given String.jid
- the input String.XmppStringprepException
- if an error occurs.public static EntityBareJid entityBareFromUnescapedOrThrowUnchecked(CharSequence cs)
entityBareFromUnescaped(CharSequence)
but does throw an unchecked IllegalArgumentException
instead of a
XmppStringprepException
.cs
- the character sequence which should be transformed to a EntityBareJid
EntityBareJid
if no exception occursIllegalArgumentException
- if the given input is not a valid JIDentityBareFromUnescaped(CharSequence)
public static EntityBareJid entityBareFromUnescaped(CharSequence unescapedJid) throws XmppStringprepException
EntityBareJid
representing the given unescaped CharSequence.unescapedJid
- the input CharSequence.XmppStringprepException
- if an error occurs.public static EntityBareJid entityBareFromUnescaped(String unescapedJidString) throws XmppStringprepException
EntityBareJid
representing the given unescaped String.unescapedJidString
- the input String.XmppStringprepException
- if an error occurs.public static EntityBareJid entityBareFromUnescapedOrNull(CharSequence cs)
cs
- the input CharSequence
null
public static EntityBareJid entityBareFrom(Localpart localpart, DomainBareJid domainBareJid)
EntityBareJid
constructed from the given Localpart
and {link DomainBareJid}.localpart
- a localpart.domainBareJid
- a domain bare JID.public static EntityBareJid entityBareFrom(Localpart localpart, Domainpart domain)
localpart
- a localpart.domain
- a domainpart.public static EntityBareJid entityBareFromOrNull(CharSequence cs)
cs
- the input CharSequence
null
public static EntityFullJid entityFullFromOrThrowUnchecked(CharSequence cs)
entityFullFrom(CharSequence)
but does throw an unchecked IllegalArgumentException
instead of a
XmppStringprepException
.cs
- the character sequence which should be transformed to a EntityFullJid
EntityFullJid
if no exception occursIllegalArgumentException
- if the given input is not a valid JIDentityFullFrom(CharSequence)
public static EntityFullJid entityFullFrom(CharSequence jid) throws XmppStringprepException
EntityFullJid
representing the given CharSequence.jid
- a CharSequence representing a JID.XmppStringprepException
- if an error occurs.public static EntityFullJid entityFullFrom(String jid) throws XmppStringprepException
EntityFullJid
representing the given String.jid
- the JID's String.XmppStringprepException
- if an error occurs.public static EntityFullJid entityFullFromOrNull(CharSequence cs)
cs
- the input CharSequence
null
public static EntityFullJid entityFullFromUnescapedOrThrowUnchecked(CharSequence cs)
entityFullFromUnescaped(CharSequence)
but does throw an unchecked IllegalArgumentException
instead of a
XmppStringprepException
.cs
- the character sequence which should be transformed to a EntityFullJid
EntityFullJid
if no exception occursIllegalArgumentException
- if the given input is not a valid JIDentityFullFromUnescaped(CharSequence)
public static EntityFullJid entityFullFromUnescaped(CharSequence unescapedJid) throws XmppStringprepException
EntityFullJid
representing the given unescaped CharSequence.unescapedJid
- a CharSequence representing a JID.XmppStringprepException
- if an error occurs.public static EntityFullJid entityFullFromUnescaped(String unescapedJidString) throws XmppStringprepException
EntityFullJid
representing the given unescaped String.unescapedJidString
- the JID's String.XmppStringprepException
- if an error occurs.public static EntityFullJid entityFullFromUnescapedOrNull(CharSequence cs)
cs
- the input CharSequence
null
public static EntityFullJid entityFullFrom(String localpart, String domainpart, String resource) throws XmppStringprepException
EntityFullJid
constructed from the given parts.localpart
- a localpart.domainpart
- a domainpart.resource
- a resourcepart.XmppStringprepException
- if an error occurs.public static EntityFullJid entityFullFrom(Localpart localpart, DomainBareJid domainBareJid, Resourcepart resource)
EntityFullJid
constructed from the given parts.localpart
- a localpart.domainBareJid
- a domain bare JID..resource
- a resourcepartpublic static EntityFullJid entityFullFrom(Localpart localpart, Domainpart domainpart, Resourcepart resource)
EntityFullJid
constructed from the given parts.localpart
- the localpart.domainpart
- the domainpart.resource
- the resourcepart.public static EntityFullJid entityFullFrom(EntityBareJid bareJid, Resourcepart resource)
bareJid
- a bare JID.resource
- a resourcepart.@Deprecated public static DomainBareJid serverBareFrom(String jid) throws XmppStringprepException
domainBareFrom(String)
insteadjid
- the JID.XmppStringprepException
- if an error happens.public static DomainBareJid domainBareFromOrThrowUnchecked(CharSequence cs)
domainBareFrom(CharSequence)
but does throw an unchecked IllegalArgumentException
instead of a
XmppStringprepException
.cs
- the character sequence which should be transformed to a EntityFullJid
EntityFullJid
if no exception occursfrom(String)
public static DomainBareJid domainBareFrom(CharSequence jid) throws XmppStringprepException
jid
- the JID CharSequence.XmppStringprepException
- if an error occurs.public static DomainBareJid domainBareFrom(String jid) throws XmppStringprepException
jid
- the JID String.XmppStringprepException
- if an error occurs.public static DomainBareJid domainBareFrom(Domainpart domainpart)
DomainBareJid
consisting of the given Domainpart
.domainpart
- the domainpart.public static DomainBareJid domainBareFromOrNull(CharSequence cs)
cs
- the input CharSequence
null
@Deprecated public static DomainFullJid serverFullFrom(String jid) throws XmppStringprepException
domainFullFrom(String)
insteadjid
- the JID.XmppStringprepException
- if an error happens.@Deprecated public static DomainFullJid donmainFullFrom(String jid) throws XmppStringprepException
domainFullFrom(String)
instead.jid
- the JID.XmppStringprepException
- if an error happens.public static DomainFullJid domainFullFromOrThrowUnchecked(CharSequence cs)
domainFullFrom(CharSequence)
but does throw an unchecked IllegalArgumentException
instead of a
XmppStringprepException
.cs
- the character sequence which should be transformed to a DomainFullJid
DomainFullJid
if no exception occursIllegalArgumentException
- if the given input is not a valid JIDdomainFullFrom(CharSequence)
public static DomainFullJid domainFullFrom(CharSequence jid) throws XmppStringprepException
jid
- the JID.XmppStringprepException
- if an error happens.public static DomainFullJid domainFullFrom(String jid) throws XmppStringprepException
jid
- the JID.XmppStringprepException
- if an error happens.public static DomainFullJid domainFullFrom(Domainpart domainpart, Resourcepart resource)
domainpart
- the domainpart.resource
- the resourcepart.public static DomainFullJid domainFullFrom(DomainBareJid domainBareJid, Resourcepart resource)
domainBareJid
- a domain bare JID.resource
- a resourcepart.public static DomainFullJid domainFullFromOrNull(CharSequence cs)
cs
- the input CharSequence
null