|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecttigase.xmpp.BareJID
public final class BareJID
Instance of the BareJID
class holds a single, bare JID. When the
object is created the parameters are checked and processed through the
stringprep. An exception is throw in case of stringprep processing error.
The instances of the class are immutable objects.
BareJID
class.
The class also offers a few utility methods for parsing and constructing JID
strings. Please see JavaDoc documentation for more details.
Created: Dec 28, 2009 10:47:51 PM
Method Summary | |
---|---|
static BareJID |
bareJIDInstance(java.lang.String jid)
The method creates an instance of the BareJID class. |
static BareJID |
bareJIDInstance(java.lang.String p_localpart,
java.lang.String p_domain)
The method creates an instance of the BareJID class. |
static BareJID |
bareJIDInstanceNS(java.lang.String jid)
The method creates an instance of the BareJID class. |
static BareJID |
bareJIDInstanceNS(java.lang.String p_localpart,
java.lang.String p_domain)
The method creates an instance of the BareJID class. |
int |
compareTo(BareJID o)
Method compares the BareJID instance to the object given
as a parameter. |
boolean |
equals(java.lang.Object b)
Method compares whether this BareJID instance represents the
same user bare JID as the one given in parameter. |
java.lang.String |
getDomain()
Method returns a domain part of the BareJID . |
java.lang.String |
getLocalpart()
Method returns a localpart (nickname) of the BareJID . |
int |
hashCode()
Method returns a hash code calculated for the BareJID instance. |
static java.lang.String |
jidToBareJID(java.lang.String jid)
A utility method to strip the resource part from the given JID string. |
static java.lang.String[] |
parseJID(java.lang.String jid)
A utility method to parse and split the given JID string into separate parts. |
java.lang.String |
toString()
Method returns a String representation of the
BareJID instance. |
static java.lang.String |
toString(BareJID bareJid,
java.lang.String p_resource)
A utility method to construct a String representing user JID from
given parameters. |
static java.lang.String |
toString(java.lang.String p_localpart,
java.lang.String p_domain)
A utility method to construct a String representing user JID from
given parameters. |
static java.lang.String |
toString(java.lang.String p_localpart,
java.lang.String p_domain,
java.lang.String p_resource)
A utility method to construct a String representing user JID from
given parameters. |
static void |
useStringprepProcessor(java.lang.String stringprepProcessor)
Changes stringprep processor implementation used for the JID checking. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Method Detail |
---|
public static BareJID bareJIDInstance(java.lang.String jid) throws TigaseStringprepException
BareJID
class. The
bare JID is parsed and constructed from the String
parameter.
The localpart (nick name) and the domain part of the JID are parsed and
processed through the stringprep. If a strngprep parsing error occurs an
exception is thrown.
jid
- is a String
parameter used to create the bare JID
instance.
BareJID
class which corresponds to
the JID given as the parameter.
TigaseStringprepException
- if the stringprep processing fails for any
JID part used to create the instance.public static BareJID bareJIDInstance(java.lang.String p_localpart, java.lang.String p_domain) throws TigaseStringprepException
BareJID
class. The
bare JID is parsed and constructed from two String
parameters.
The localpart (nick name) and the domain part of the JID are parsed and
processed through the stringprep. If a strngprep parsing error occurs an
exception is thrown.
p_localpart
- is a String
parameter assumed to be a
JID localpart (nickname) and used to create the bare JID instance. The
localpart parameter can be null.p_domain
- is a String
parameter assumed to be a JID
domain part and used to create the bare JID instance. This parameter must not
be null.
BareJID
class which corresponds to
the JID given as the parameter.
TigaseStringprepException
- if the stringprep processing fails for any
JID part used to create the instance.public static BareJID bareJIDInstanceNS(java.lang.String jid)
BareJID
class. The
bare JID is parsed and constructed from the String
parameter.
Note, this method does not perform stringprep processing on input
parameters.
The resource part, if provided in the JID paramater, is thrown away.
Please note, the method does not necessarily has to return a new instance
of the class. It may return the same exact object every time you pass
parameters which refer to the same bare JID identifier.
jid
- is a String
parameter used to create the bare JID
instance.
BareJID
class which corresponds to
the JID given as the parameter.public static BareJID bareJIDInstanceNS(java.lang.String p_localpart, java.lang.String p_domain)
BareJID
class. The
bare JID is parsed and constructed from two String
parameters.
Note, this method does not perform stringprep processing on input
parameters.
Please note, the method does not necessarily has to return a new instance
of the class. It may return the same exact object every time you pass
parameters which refer to the same bare JID identifier.
p_localpart
- is a String
parameter assumed to be a
JID localpart (nickname) and used to create the bare JID instance. The
localpart parameter can be null.p_domain
- is a String
parameter assumed to be a JID
domain part and used to create the bare JID instance. This parameter must not
be null.
BareJID
class which corresponds to
the JID given as the parameter.public static java.lang.String jidToBareJID(java.lang.String jid)
jid
- is a String
representing user full JID.
String
instance of the JID wihout resource part.public static java.lang.String[] parseJID(java.lang.String jid)
String
array:
jid
- is a String
representing user full JID.
String
array with parsed JID parts.
The array may contain null elements.public static java.lang.String toString(java.lang.String p_localpart, java.lang.String p_domain)
String
representing user JID from
given parameters.
The method doesn't perform any checkings and it doesn't run stringprep
processing on the given parameter. This is a pure string manipulation utility
method.
p_localpart
- is a JID's localpart (nickname)p_domain
- is a JID's domain part.
String
representing user's JID build from given
parameters. If the localpart is null then the method simply returns parameter
given as domain part.public static java.lang.String toString(java.lang.String p_localpart, java.lang.String p_domain, java.lang.String p_resource)
String
representing user JID from
given parameters.
The method doesn't perform any checkings and it doesn't run stringprep
processing on the given parameter. This is a pure string manipulation utility
method.
p_localpart
- is a JID's localpart (nickname)p_domain
- is a JID's domain part.p_resource
- is a JID's resource part.
String
representing user's JID build from given
parameters. If the localpart and resource part is null then the method simply
returns parameter given as domain part.public static java.lang.String toString(BareJID bareJid, java.lang.String p_resource)
String
representing user JID from
given parameters.
The method doesn't perform any checkings and it doesn't run stringprep
processing on the resource parameter.
bareJid
- is a BareJID
instance.p_resource
- is a JID's resource part.
String
representing user's JID build from given
parameters.public static void useStringprepProcessor(java.lang.String stringprepProcessor)
JID
and BareJID
instances are created using a new processor.
stringprepProcessor
- is a String
value with stringprep processor
name or class name implementing stringprep processing interface.public int compareTo(BareJID o)
BareJID
instance to the object given
as a parameter. The method implements the compareTo
specification contract and returns values as we would expect from the
call:
bareJID_1.toString().compareTo(bareJID_2.toString())
compareTo
in interface java.lang.Comparable<BareJID>
o
- is an BareJID
instance with which the comparision
is performed.
bareJID_1.toString().compareTo(bareJID_2.toString())
public boolean equals(java.lang.Object b)
BareJID
instance represents the
same user bare JID as the one given in parameter. It returns
true
of both the localpart (nickname) and domain part are the
same for both objects.
equals
in class java.lang.Object
b
- is a BareJID
object to which the instance is compared.
boolean
value of true
if both instances
represent the same bare JID and false
otherwise.public java.lang.String getDomain()
BareJID
. Please note the
String
returned is parsed, checked and processed via stringprep,
hence it represents a valid domain name as defined in XMPP RFC.
BareJID
instance.public java.lang.String getLocalpart()
BareJID
.
Please note the String
returned is parsed, checked and processed
via stringprep, hence it represents a valid localpart as defined in XMPP RFC.
BareJID
instance.public int hashCode()
BareJID
instance.
hashCode
in class java.lang.Object
public java.lang.String toString()
String
representation of the
BareJID
instance.
toString
in class java.lang.Object
String
representation of the
BareJID
instance.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |