Smack

org.jivesoftware.smackx.packet
Class DiscoverInfo.Identity

java.lang.Object
  extended by org.jivesoftware.smackx.packet.DiscoverInfo.Identity
All Implemented Interfaces:
java.lang.Comparable<DiscoverInfo.Identity>
Enclosing class:
DiscoverInfo

public static class DiscoverInfo.Identity
extends java.lang.Object
implements java.lang.Comparable<DiscoverInfo.Identity>

Represents the identity of a given XMPP entity. An entity may have many identities but all the identities SHOULD have the same name.

Refer to Jabber::Registrar in order to get the official registry of values for the category and type attributes.


Constructor Summary
DiscoverInfo.Identity(java.lang.String category, java.lang.String name)
          Deprecated. As per the spec, the type field is mandatory and the 3 argument constructor should be used instead.
DiscoverInfo.Identity(java.lang.String category, java.lang.String name, java.lang.String type)
          Creates a new identity for an XMPP entity.
 
Method Summary
 int compareTo(DiscoverInfo.Identity other)
          Compares this identity with another one.
 boolean equals(java.lang.Object obj)
          Check equality for Identity for category, type, lang and name in that order as defined by XEP-0015 5.4 Processing Method (Step 3.3)
 java.lang.String getCategory()
          Returns the entity's category.
 java.lang.String getLanguage()
          Returns the identities natural language if one is set
 java.lang.String getName()
          Returns the identity's name.
 java.lang.String getType()
          Returns the entity's type.
 int hashCode()
           
 void setLanguage(java.lang.String lang)
          Sets the natural language (xml:lang) for this identity (optional)
 void setType(java.lang.String type)
          Deprecated. As per the spec, this field is mandatory and the 3 argument constructor should be used instead.
 java.lang.String toXML()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DiscoverInfo.Identity

public DiscoverInfo.Identity(java.lang.String category,
                             java.lang.String name)
Deprecated. As per the spec, the type field is mandatory and the 3 argument constructor should be used instead.

Creates a new identity for an XMPP entity.

Parameters:
category - the entity's category.
name - the entity's name.

DiscoverInfo.Identity

public DiscoverInfo.Identity(java.lang.String category,
                             java.lang.String name,
                             java.lang.String type)
Creates a new identity for an XMPP entity. 'category' and 'type' are required by XEP-30 XML Schemas

Parameters:
category - the entity's category (required as per XEP-30).
name - the entity's name.
type - the entity's type (required as per XEP-30).
Method Detail

getCategory

public java.lang.String getCategory()
Returns the entity's category. To get the official registry of values for the 'category' attribute refer to Jabber::Registrar

Returns:
the entity's category.

getName

public java.lang.String getName()
Returns the identity's name.

Returns:
the identity's name.

getType

public java.lang.String getType()
Returns the entity's type. To get the official registry of values for the 'type' attribute refer to Jabber::Registrar

Returns:
the entity's type.

setType

public void setType(java.lang.String type)
Deprecated. As per the spec, this field is mandatory and the 3 argument constructor should be used instead.

Sets the entity's type. To get the official registry of values for the 'type' attribute refer to Jabber::Registrar

Parameters:
type - the identity's type.

setLanguage

public void setLanguage(java.lang.String lang)
Sets the natural language (xml:lang) for this identity (optional)

Parameters:
lang - the xml:lang of this Identity

getLanguage

public java.lang.String getLanguage()
Returns the identities natural language if one is set

Returns:
the value of xml:lang of this Identity

toXML

public java.lang.String toXML()

equals

public boolean equals(java.lang.Object obj)
Check equality for Identity for category, type, lang and name in that order as defined by XEP-0015 5.4 Processing Method (Step 3.3)

Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

compareTo

public int compareTo(DiscoverInfo.Identity other)
Compares this identity with another one. The comparison order is: Category, Type, Lang. If all three are identical the other Identity is considered equal. Name is not used for comparision, as defined by XEP-0115

Specified by:
compareTo in interface java.lang.Comparable<DiscoverInfo.Identity>
Parameters:
obj -
Returns:

Smack

Copyright © 2003-2007 Jive Software.