Class SFSBuddy

java.lang.Object
sfs3.client.entities.SFSBuddy
All Implemented Interfaces:
Buddy

public class SFSBuddy extends Object implements Buddy
The SFSBuddy object represents a buddy in the current user's buddy list.
See Also:
  • Field Details

    • name

      protected String name
    • id

      protected int id
    • isBlocked

      protected boolean isBlocked
    • variables

      protected Map<String,BuddyVariable> variables
    • isTemp

      protected boolean isTemp
  • Constructor Details

    • SFSBuddy

      public SFSBuddy(int id, String name, boolean isBlocked, boolean isTemp)
      Creates a new SFSBuddy instance.

      NOTE: never instantiate a SFSBuddy manually: this is done by the SmartFoxServer 3 API internally.

    • SFSBuddy

      public SFSBuddy(int id, String name, boolean isBlocked)
    • SFSBuddy

      public SFSBuddy(int id, String name)
  • Method Details

    • fromSFSArray

      public static Buddy fromSFSArray(ISFSArray arr)
      Internal
    • getId

      public int getId()
      Description copied from interface: Buddy
      The buddy id. This is equal to the id assigned by SmartFoxServer to the corresponding User.
      Specified by:
      getId in interface Buddy
      See Also:
    • getName

      public String getName()
      Description copied from interface: Buddy
      The name of this buddy. This is equal to the login name of the corresponding User.
      Specified by:
      getName in interface Buddy
      See Also:
    • getDisplayName

      public String getDisplayName()
      Description copied from interface: Buddy
      If a Buddy nickname exists returns that nickname, otherwise returns the User's login name.
      Specified by:
      getDisplayName in interface Buddy
      Returns:
      the nickname (if any), otherwise the User's name.
    • isBlocked

      public boolean isBlocked()
      Description copied from interface: Buddy
      Indicates whether this buddy is blocked in the current user's buddies list or not. A buddy can be blocked by means of a BlockBuddyRequest request.
      Specified by:
      isBlocked in interface Buddy
      See Also:
    • isOnline

      public boolean isOnline()
      Description copied from interface: Buddy
      Indicates whether this buddy is online in the Buddy List system or not.
      Specified by:
      isOnline in interface Buddy
    • isTemp

      public boolean isTemp()
      Description copied from interface: Buddy
      Indicates whether this buddy is temporary (non-persistent) in the current user's buddies list or not.
      Specified by:
      isTemp in interface Buddy
    • getState

      public String getState()
      Description copied from interface: Buddy
      Returns the custom state of this buddy. Examples of custom states are "Available", "Busy", "Be right back", etc. If the custom state is not set, null is returned.

      The list of available custom states is returned by the IBuddyManager.buddyStates property.

      Specified by:
      getState in interface Buddy
      See Also:
    • getNickName

      public String getNickName()
      Description copied from interface: Buddy
      Returns the nickname of this buddy. If the nickname is not set, null is returned.
      Specified by:
      getNickName in interface Buddy
    • getVariables

      public List<BuddyVariable> getVariables()
      Description copied from interface: Buddy
      Returns a list of BuddyVariable objects associated with the buddy.
      Specified by:
      getVariables in interface Buddy
      See Also:
    • getVariable

      public BuddyVariable getVariable(String varName)
      Description copied from interface: Buddy
      Retrieves a Buddy Variable from its name.
      Specified by:
      getVariable in interface Buddy
      Parameters:
      varName - The name of the Buddy Variable to be retrieved.
      Returns:
      The BuddyVariable object representing the Buddy Variable, or null if no Buddy Variable with the passed name is associated with this buddy.
      See Also:
    • containsVariable

      public boolean containsVariable(String varName)
      Description copied from interface: Buddy
      Indicates whether this buddy has the specified Buddy Variable set or not.
      Specified by:
      containsVariable in interface Buddy
      Parameters:
      varName - The name of the Buddy Variable whose existence must be checked.
      Returns:
      true if a Buddy Variable with the passed name is set for this buddy.
    • getOfflineVariables

      public List<BuddyVariable> getOfflineVariables()
      Description copied from interface: Buddy
      Retrieves the list of persistent Buddy Variables of this buddy.
      Specified by:
      getOfflineVariables in interface Buddy
      Returns:
      A List of BuddyVariable objects.
      See Also:
    • getOnlineVariables

      public List<BuddyVariable> getOnlineVariables()
      Description copied from interface: Buddy
      Retrieves the list of non-persistent Buddy Variables of this buddy.
      Specified by:
      getOnlineVariables in interface Buddy
      Returns:
      A List of BuddyVariable objects.
      See Also:
    • setVariable

      public void setVariable(BuddyVariable bVar)
      Specified by:
      setVariable in interface Buddy
    • setVariables

      public void setVariables(List<BuddyVariable> variables)
      Specified by:
      setVariables in interface Buddy
      Internal
    • setId

      public void setId(int id)
      Specified by:
      setId in interface Buddy
      Internal
    • setBlocked

      public void setBlocked(boolean blocked)
      Specified by:
      setBlocked in interface Buddy
      Internal
    • removeVariable

      public void removeVariable(String varName)
      Specified by:
      removeVariable in interface Buddy
      Internal
    • clearVolatileVariables

      public void clearVolatileVariables()
      Specified by:
      clearVolatileVariables in interface Buddy
      Internal
    • equals

      public boolean equals(Object that)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Returns a string that contains the buddy name and id.
      Overrides:
      toString in class Object
      Returns:
      The string representation of the SFSBuddy object.