Class DiscoverInfo.Identity

    • Constructor Summary

      Constructors 
      Constructor Description
      Identity​(java.lang.String category, java.lang.String type)
      Creates a new identity for an XMPP entity.
      Identity​(java.lang.String category, java.lang.String name, java.lang.String type)
      Creates a new identity for an XMPP entity.
      Identity​(java.lang.String category, java.lang.String type, java.lang.String name, java.lang.String lang)
      Creates a new identity for an XMPP entity.
    • Constructor Detail

      • Identity

        public Identity​(java.lang.String category,
                        java.lang.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​(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).
      • Identity

        public Identity​(java.lang.String category,
                        java.lang.String type,
                        java.lang.String name,
                        java.lang.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

      • getName

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

        public java.lang.String getLanguage()
        Returns the identities natural language if one is set.
        Returns:
        the value of xml:lang of this Identity
      • isOfCategoryAndType

        public boolean isOfCategoryAndType​(java.lang.String category,
                                           java.lang.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.
      • 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 comparison, as defined by XEP-0115
        Specified by:
        compareTo in interface java.lang.Comparable<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.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object