/** * Get a {@link DomainFullJid} from a given {@link CharSequence} or {@code null} if the input does not represent a JID. * * @param cs the input {@link CharSequence} * @return a JID or {@code null} */ public static DomainFullJid domainFullFromOrNull(CharSequence cs) { try { return domainFullFrom(cs); } catch (XmppStringprepException e) { return null; } } }
/** * Get a domain full JID from the given CharSequence. * * @param jid the JID. * @return a domain full JID. * @throws XmppStringprepException if an error happens. */ public static DomainFullJid domainFullFrom(CharSequence jid) throws XmppStringprepException { return domainFullFrom(jid.toString()); }
/** * Get a domain full JID from the given String. * * @param jid the JID. * @return a DomainFullJid. * @throws XmppStringprepException if an error happens. * @deprecated use {@link #domainFullFrom(String)} instead. */ @Deprecated public static DomainFullJid donmainFullFrom(String jid) throws XmppStringprepException { return domainFullFrom(jid); }
/** * Like {@link #domainFullFrom(CharSequence)} but does throw an unchecked {@link IllegalArgumentException} instead of a * {@link XmppStringprepException}. * * @param cs the character sequence which should be transformed to a {@link DomainFullJid} * @return the {@link DomainFullJid} if no exception occurs * @throws IllegalArgumentException if the given input is not a valid JID * @see #domainFullFrom(CharSequence) * @since 0.6.2 */ public static DomainFullJid domainFullFromOrThrowUnchecked(CharSequence cs) { try { return domainFullFrom(cs); } catch (XmppStringprepException e) { throw new IllegalArgumentException(e); } }
/** * Get a domain full JID. * * @param domainpart the domainpart. * @param resource the resourcepart. * @return a domain full JID. */ public static DomainFullJid domainFullFrom(Domainpart domainpart, Resourcepart resource) { return domainFullFrom(domainBareFrom(domainpart), resource); }