Class RosterEntry


  • public final class RosterEntry
    extends org.jivesoftware.smack.Manager
    Each user in your roster is represented by a roster entry, which contains the user's JID and a name or nickname you assign.
    • Method Summary

      All Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      void cancelSubscription()
      Cancel the presence subscription the XMPP entity representing this roster entry has with us.
      boolean canSeeHisPresence()
      Check if we are subscribed to the contact's presence.
      boolean canSeeMyPresence()
      Check if the contact is subscribed to "my" presence.
      boolean equals​(java.lang.Object object)  
      boolean equalsDeep​(java.lang.Object obj)
      Indicates whether some other object is "equal to" this by comparing all members.
      java.util.List<RosterGroup> getGroups()
      Returns an copied list of the roster groups that this entry belongs to.
      org.jxmpp.jid.BareJid getJid()
      Returns the JID associated with this entry.
      java.lang.String getName()
      Returns the name associated with this entry.
      RosterPacket.ItemType getType()
      Returns the roster subscription type of the entry.
      java.lang.String getUser()
      Deprecated.
      use getJid() instead.
      int hashCode()  
      boolean isApproved()
      Returns the pre-approval state of this entry.
      boolean isSubscriptionPending()
      Returns the roster subscription request status of the entry.
      void setName​(java.lang.String name)
      Sets the name associated with this entry.
      java.lang.String toString()  
      • Methods inherited from class org.jivesoftware.smack.Manager

        connection, getAuthenticatedConnectionOrThrow, schedule, schedule, scheduleBlocking
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Method Detail

      • getUser

        @Deprecated
        public java.lang.String getUser()
        Deprecated.
        use getJid() instead.
        Returns the JID of the user associated with this entry.
        Returns:
        the user associated with this entry.
      • getJid

        public org.jxmpp.jid.BareJid getJid()
        Returns the JID associated with this entry.
        Returns:
        the user associated with this entry.
      • getName

        public java.lang.String getName()
        Returns the name associated with this entry.
        Returns:
        the name.
      • setName

        public void setName​(java.lang.String name)
                     throws org.jivesoftware.smack.SmackException.NotConnectedException,
                            org.jivesoftware.smack.SmackException.NoResponseException,
                            org.jivesoftware.smack.XMPPException.XMPPErrorException,
                            java.lang.InterruptedException
        Sets the name associated with this entry.
        Parameters:
        name - the name.
        Throws:
        org.jivesoftware.smack.SmackException.NotConnectedException - if the XMPP connection is not connected.
        org.jivesoftware.smack.XMPPException.XMPPErrorException - if there was an XMPP error returned.
        org.jivesoftware.smack.SmackException.NoResponseException - if there was no response from the remote entity.
        java.lang.InterruptedException - if the calling thread was interrupted.
      • isApproved

        public boolean isApproved()
        Returns the pre-approval state of this entry.
        Returns:
        the pre-approval state.
      • getGroups

        public java.util.List<RosterGroup> getGroups()
        Returns an copied list of the roster groups that this entry belongs to.
        Returns:
        an iterator for the groups this entry belongs to.
      • getType

        public RosterPacket.ItemType getType()
        Returns the roster subscription type of the entry. When the type is RosterPacket.ItemType.none or RosterPacket.ItemType.from, refer to getStatus() to see if a subscription request is pending.
        Returns:
        the type.
      • isSubscriptionPending

        public boolean isSubscriptionPending()
        Returns the roster subscription request status of the entry. If true, then the contact did not answer the subscription request yet.
        Returns:
        the status.
        Since:
        4.2
      • canSeeMyPresence

        public boolean canSeeMyPresence()
        Check if the contact is subscribed to "my" presence. This allows the contact to see the presence information.
        Returns:
        true if the contact has a presence subscription.
        Since:
        4.2
      • canSeeHisPresence

        public boolean canSeeHisPresence()
        Check if we are subscribed to the contact's presence. If true then the contact has allowed us to receive presence information.
        Returns:
        true if we are subscribed to the contact's presence.
        Since:
        4.2
      • cancelSubscription

        public void cancelSubscription()
                                throws org.jivesoftware.smack.SmackException.NotConnectedException,
                                       java.lang.InterruptedException
        Cancel the presence subscription the XMPP entity representing this roster entry has with us.
        Throws:
        org.jivesoftware.smack.SmackException.NotConnectedException - if the XMPP connection is not connected.
        java.lang.InterruptedException - if the calling thread was interrupted.
        Since:
        4.2
      • toString

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

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

        public boolean equals​(java.lang.Object object)
        Overrides:
        equals in class java.lang.Object
      • equalsDeep

        public boolean equalsDeep​(java.lang.Object obj)
        Indicates whether some other object is "equal to" this by comparing all members.

        The equals(Object) method returns true if the user JIDs are equal.

        Parameters:
        obj - the reference object with which to compare.
        Returns:
        true if this object is the same as the obj argument; false otherwise.