Package org.jxmpp.jid.parts
Class Localpart
- java.lang.Object
- 
- org.jxmpp.jid.parts.Part
- 
- org.jxmpp.jid.parts.Localpart
 
 
- 
- All Implemented Interfaces:
- Serializable,- CharSequence
 
 public class Localpart extends Part A localpart of an XMPP address (JID). The localpart is the part before the first @ sign in an XMPP address and usually identifies the user (or the XMPP entity) within an XMPP service. It is also often referred to as "username", but note that the actual username used to login may be different from the resulting localpart of the user's JID.You can create instances of this class from Strings using from(String).- See Also:
- RFC 6122 ยง 2.3. Localpart, Serialized Form
 
- 
- 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description StringasUnescapedString()Return the unescaped String representation of this Localpart.static LocalpartformUnescapedOrNull(CharSequence cs)static Localpartfrom(String localpart)Get theLocalpartrepresenting the input String.static Localpartfrom(String localpart, JxmppContext context)Get theLocalpartrepresenting the input String.static LocalpartfromOrNull(CharSequence cs)static LocalpartfromOrThrowUnchecked(CharSequence cs)Likefrom(String)but does throw an uncheckedIllegalArgumentExceptioninstead of aXmppStringprepException.static LocalpartfromUnescaped(CharSequence unescapedLocalpart)Get aLocalpartfrom an unescaped CharSequence.static LocalpartfromUnescaped(String unescapedLocalpart)Get aLocalpartfrom an unescaped String.static LocalpartfromUnescapedOrThrowUnchecked(CharSequence cs)LikefromUnescaped(String)but does throw an uncheckedIllegalArgumentExceptioninstead of aXmppStringprepException.- 
Methods inherited from class org.jxmpp.jid.parts.PartassertNotLongerThan1023BytesOrEmpty, charAt, equals, hashCode, intern, length, subSequence, toString
 - 
Methods inherited from class java.lang.Objectclone, finalize, getClass, notify, notifyAll, wait, wait, wait
 - 
Methods inherited from interface java.lang.CharSequencechars, codePoints
 
- 
 
- 
- 
- 
Method Detail- 
asUnescapedStringpublic String asUnescapedString() Return the unescaped String representation of this Localpart.Since certain Unicode code points are disallowed in the localpart of a JID by the required stringprep profile, those need to get escaped when used in a real JID. The unescaped representation of the JID is only for presentation to a human user or for gatewaying to a non-XMPP system. - Returns:
- the unescaped String representation of this JID.
- Since:
- 0.6.1
- See Also:
- Jid.asUnescapedString()
 
 - 
fromOrThrowUncheckedpublic static Localpart fromOrThrowUnchecked(CharSequence cs) Likefrom(String)but does throw an uncheckedIllegalArgumentExceptioninstead of aXmppStringprepException.- Parameters:
- cs- the character sequence which should be transformed to a- Localpart
- Returns:
- the Localpartif no exception occurs
- Throws:
- IllegalArgumentException- if the given input is not a valid- Localpart
- Since:
- 0.6.2
- See Also:
- from(String)
 
 - 
fromUnescapedOrThrowUncheckedpublic static Localpart fromUnescapedOrThrowUnchecked(CharSequence cs) LikefromUnescaped(String)but does throw an uncheckedIllegalArgumentExceptioninstead of aXmppStringprepException.- Parameters:
- cs- the character sequence which should be transformed to a- Localpart
- Returns:
- the Localpartif no exception occurs
- Since:
- 0.6.2
- See Also:
- from(String)
 
 - 
formUnescapedOrNullpublic static Localpart formUnescapedOrNull(CharSequence cs) - Parameters:
- cs- the input CharSequence
- Returns:
- a Localpart or null
 
 - 
fromUnescapedpublic static Localpart fromUnescaped(String unescapedLocalpart) throws XmppStringprepException Get aLocalpartfrom an unescaped String.- Parameters:
- unescapedLocalpart- an unescaped String representing a Localpart.
- Returns:
- a Localpart
- Throws:
- XmppStringprepException- if an error occurs.
- Since:
- 0.6.2
 
 - 
fromUnescapedpublic static Localpart fromUnescaped(CharSequence unescapedLocalpart) throws XmppStringprepException Get aLocalpartfrom an unescaped CharSequence.- Parameters:
- unescapedLocalpart- an unescaped CharSequence representing a Localpart.
- Returns:
- a Localpart
- Throws:
- XmppStringprepException- if an error occurs.
- Since:
- 0.6.2
 
 - 
fromOrNullpublic static Localpart fromOrNull(CharSequence cs) - Parameters:
- cs- the input CharSequence
- Returns:
- a Localpart or null
 
 - 
frompublic static Localpart from(String localpart) throws XmppStringprepException Get theLocalpartrepresenting the input String.- Parameters:
- localpart- the input String.
- Returns:
- the localpart.
- Throws:
- XmppStringprepException- if an error occurs.
 
 - 
frompublic static Localpart from(String localpart, JxmppContext context) throws XmppStringprepException Get theLocalpartrepresenting the input String.- Parameters:
- localpart- the input String.
- context- the JXMPP context.
- Returns:
- the localpart.
- Throws:
- XmppStringprepException- if an error occurs.
 
 
- 
 
-