|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecttigase.xmpp.JID
public final class JID
The class defines an instance of a single XMPP JID identifier. When the object is created all parameters are checked and processed through the stringprep. An exception is thrown in case of a stringprep processing error. Created: Dec 28, 2009 10:48:04 PM
Method Summary | |
---|---|
int |
compareTo(JID o)
Method compares the JID instance with a given object. |
JID |
copyWithoutResource()
The method returns a copy of the JID instance with removed
resource part. |
JID |
copyWithResource(java.lang.String resource)
The method returns a copy of the JID instance with a different
resource part given as a parameter. |
JID |
copyWithResourceNS(java.lang.String resource)
The method returns a copy of the JID instance with a different
resource part given as a parameter. |
boolean |
equals(java.lang.Object b)
Method compares whether this JID instance represents the
same user JID as the one given in parameter. |
BareJID |
getBareJID()
Method returns BareJID instance for this JID. |
java.lang.String |
getDomain()
Method returns a domain part of the JID instance. |
java.lang.String |
getLocalpart()
Method a localpart (nickname) of the JID instance. |
java.lang.String |
getResource()
Method a resource part of the JID instance. |
int |
hashCode()
Method returns a hash code calculated for the JID instance. |
static JID |
jidInstance(BareJID bareJid)
Creates a new JID instance using given BareJID
instance as a parameter. |
static JID |
jidInstance(BareJID bareJid,
java.lang.String p_resource)
Constructs a new JID instance using given BareJID
instance as user bare JID and String instance as a resource part. |
static JID |
jidInstance(java.lang.String jid)
Constructs a new JID instance using a JID parameter given
as a String instance. |
static JID |
jidInstance(java.lang.String localpart,
java.lang.String domain,
java.lang.String resource)
Constructs a new JID instance using given String
parameters. |
static JID |
jidInstanceNS(BareJID bareJid,
java.lang.String p_resource)
Constructs a new JID instance using given BareJID
instance as user bare JID and String instance as a resource part. |
static JID |
jidInstanceNS(java.lang.String jid)
Constructs a new JID instance using a JID parameter given
as a String instance. |
static JID |
jidInstanceNS(java.lang.String localpart,
java.lang.String domain,
java.lang.String resource)
Constructs a new JID instance using given String
parameters. |
java.lang.String |
toString()
Method returns a String representation of the
JID instance. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Method Detail |
---|
public static JID jidInstance(BareJID bareJid, java.lang.String p_resource) throws TigaseStringprepException
JID
instance using given BareJID
instance as user bare JID and String
instance as a resource part.
As the BareJID
instances are immutable the constructor
doesn't create a copy of the given BareJID
, instead it saves
the reference to a given object.
bareJid
- is a BareJID
instance used to create the
JID
instance.p_resource
- is a String
instance representing JID's
resource part.
JID
class instance.
TigaseStringprepException
- exception if there was an error during
stringprep processing.public static JID jidInstance(BareJID bareJid)
JID
instance using given BareJID
instance as a parameter. The resource part is set to null.BareJID
instances are immutable the constructor
doesn't create a copy of the given BareJID
, instead it saves
the reference to a given object.
bareJid
- is a BareJID
instance used to create the
JID
instance.
JID
class instance.public static JID jidInstance(java.lang.String jid) throws TigaseStringprepException
JID
instance using a JID parameter given
as a String
instance. The parameter is parsed, checked and
run through stringprep processing. An exception is thrown if there is
an error while the JID is checked.
jid
- a JID parameter given as a String
instance.
JID
class instance.
TigaseStringprepException
- exception if there was an error during
stringprep processing.public static JID jidInstance(java.lang.String localpart, java.lang.String domain, java.lang.String resource) throws TigaseStringprepException
JID
instance using given String
parameters.
All the String
parameters are parsed, checked and run through
the stringprep processing. In case of stringprep error, an exception is thrown.
localpart
- is a String
instance representing JID's
localpart (nickname) part.domain
- is a String
instance representing JID's
domain part.resource
- is a String
instance representing JID's
resource part.
JID
class instance.
TigaseStringprepException
- exception if there was an error during
stringprep processing.public static JID jidInstanceNS(BareJID bareJid, java.lang.String p_resource)
JID
instance using given BareJID
instance as user bare JID and String
instance as a resource part.
Note, this method does not perform stringprep processing on input
parameters.
As the BareJID
instances are immutable the constructor
doesn't create a copy of the given BareJID
, instead it saves
the reference to a given object.
bareJid
- is a BareJID
instance used to create the
JID
instance.p_resource
- is a String
instance representing JID's
resource part.
JID
class instance.public static JID jidInstanceNS(java.lang.String jid)
JID
instance using a JID parameter given
as a String
instance.
Note, this method does not perform stringprep processing on input
parameters.
jid
- a JID parameter given as a String
instance.
JID
class instance.public static JID jidInstanceNS(java.lang.String localpart, java.lang.String domain, java.lang.String resource)
JID
instance using given String
parameters.
Note, this method does not perform stringprep processing on input
parameters.
localpart
- is a String
instance representing JID's
localpart (nickname) part.domain
- is a String
instance representing JID's
domain part.resource
- is a String
instance representing JID's
resource part.
JID
class instance.public int compareTo(JID o)
JID
instance with a given object.
The implementation fulfills the specification contract and returns a value
as you would expect from the call:
jid_1.toString().compareTo(jid_2.toString())
compareTo
in interface java.lang.Comparable<JID>
o
- is a JID
instance to compare to.
public JID copyWithResource(java.lang.String resource) throws TigaseStringprepException
JID
instance with a different
resource part given as a parameter.
resource
- is a String
instance representing JID's
new resource part.
JID
class with a new resource
part.
TigaseStringprepException
- if resource stringprep processing fails.public JID copyWithResourceNS(java.lang.String resource)
JID
instance with a different
resource part given as a parameter.
resource
- is a String
instance representing JID's
new resource part.
JID
class with a new resource
part.public JID copyWithoutResource()
JID
instance with removed
resource part. The result is similar to the BareJID
instance,
however there are APIs which require JID
object to use.
JID
class with removed resource
part.public boolean equals(java.lang.Object b)
JID
instance represents the
same user JID as the one given in parameter. It returns
true
of all: the localpart (nickname), domain part,
and the resource part are the same for both objects.
equals
in class java.lang.Object
b
- is a JID
object to which the instance is compared.
boolean
value of true
if both instances
represent the same JID and false
otherwise.public BareJID getBareJID()
BareJID
instance for this JID.
BareJID
instance.public java.lang.String getDomain()
JID
instance.
JID
instance.public java.lang.String getLocalpart()
JID
instance.
JID
instance.public java.lang.String getResource()
JID
instance.
JID
instance.public int hashCode()
JID
instance.
hashCode
in class java.lang.Object
public java.lang.String toString()
String
representation of the
JID
instance.
toString
in class java.lang.Object
String
representation of the JID
instance.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |