Class DiscoverInfo.Identity
- java.lang.Object
-
- org.jivesoftware.smackx.disco.packet.DiscoverInfo.Identity
-
- All Implemented Interfaces:
Comparable<DiscoverInfo.Identity>
- Enclosing class:
- DiscoverInfo
public static final class DiscoverInfo.Identity extends Object implements 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 XMPP Registry for Service Discovery Identities in order to get the official registry of values for the category and type attributes.
-
-
Constructor Summary
Constructors Constructor Description Identity(String category, String type)
Creates a new identity for an XMPP entity.Identity(String category, String name, String type)
Creates a new identity for an XMPP entity.Identity(String category, String type, String name, String lang)
Creates a new identity for an XMPP entity.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(DiscoverInfo.Identity other)
Compares this identity with another one.boolean
equals(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).String
getCategory()
Returns the entity's category.String
getLanguage()
Returns the identities natural language if one is set.String
getName()
Returns the identity's name.String
getType()
Returns the entity's type.int
hashCode()
boolean
isOfCategoryAndType(String category, String type)
Returns true if this identity is of the given category and type.String
toString()
XmlStringBuilder
toXML()
-
-
-
Constructor Detail
-
Identity
public Identity(String category, String type)
Creates a new identity for an XMPP entity.- Parameters:
category
- the entity's category (required as per XEP-30).type
- the entity's type (required as per XEP-30).
-
Identity
public Identity(String category, String name, 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).
-
Identity
public Identity(String category, String type, String name, String lang)
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).type
- the entity's type (required as per XEP-30).name
- the entity's name.lang
- the entity's lang.
-
-
Method Detail
-
getCategory
public String getCategory()
Returns the entity's category. To get the official registry of values for the 'category' attribute refer to XMPP Registry for Service Discovery Identities.- Returns:
- the entity's category.
-
getType
public String getType()
Returns the entity's type. To get the official registry of values for the 'type' attribute refer to XMPP Registry for Service Discovery Identities.- Returns:
- the entity's type.
-
getLanguage
public String getLanguage()
Returns the identities natural language if one is set.- Returns:
- the value of xml:lang of this Identity
-
isOfCategoryAndType
public boolean isOfCategoryAndType(String category, String type)
Returns true if this identity is of the given category and type.- Parameters:
category
- the category.type
- the type.- Returns:
- true if this identity is of the given category and type.
-
toXML
public XmlStringBuilder toXML()
-
equals
public boolean equals(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).
-
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 comparison, as defined by XEP-0115- Specified by:
compareTo
in interfaceComparable<DiscoverInfo.Identity>
- Parameters:
other
- TODO javadoc me please- Returns:
- a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
-
-