All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.pusher.client.channel.User.html Maven / Gradle / Ivy

There is a newer version: 2.4.4
Show newest version





User (Pusher Java Websocket API)












com.pusher.client.channel

Class User

  • java.lang.Object
    • com.pusher.client.channel.User


  • public class User
    extends java.lang.Object
    Represents a user that is subscribed to a PresenceChannel.
    • Constructor Summary

      Constructors 
      Constructor and Description
      User(java.lang.String id, java.lang.String jsonData)
      Create a new user.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      boolean equals(java.lang.Object other) 
      java.lang.String getId()
      A unique identifier for the user within a Pusher application.
      java.lang.String getInfo()
      Custom additional information about a user as a String encoding a JSON hash
      <V> V getInfo(java.lang.Class<V> clazz)
      Custom additional information about a user decoded as a new instance of the provided POJO bean type
      int hashCode() 
      java.lang.String toString() 
      • Methods inherited from class java.lang.Object

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

      • User

        public User(java.lang.String id,
                    java.lang.String jsonData)
        Create a new user. Users should not be created within an application. Users are created within the library and represent subscriptions to presence channels.
        Parameters:
        id - The user id
        jsonData - The user JSON data
    • Method Detail

      • getId

        public java.lang.String getId()
        A unique identifier for the user within a Pusher application.
        Returns:
        The unique id.
      • getInfo

        public java.lang.String getInfo()
        Custom additional information about a user as a String encoding a JSON hash
        Returns:
        The user info as a JSON string
      • getInfo

        public <V> V getInfo(java.lang.Class<V> clazz)

        Custom additional information about a user decoded as a new instance of the provided POJO bean type

        e.g. if getInfo() returns {"name":"Mr User","number":9} then you might implement as follows:

         public class UserInfo {
             private String name;
             private Integer number;
        
             public String getName() { return name; }
             public void setName(String name) { this.name = name; }
        
             public Integer getNumber() { return number; }
             public void setNumber(Integer number) { this.number = number; }
         }
        
         UserInfo info = user.getInfo(UserInfo.class);
        
         info.getName() // returns "Mr User"
         info.getNumber() // returns 9
         
        Type Parameters:
        V - The class of the info
        Parameters:
        clazz - the class into which the user info JSON representation should be parsed.
        Returns:
        V An instance of clazz, populated with the user info
      • 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 other)
        Overrides:
        equals in class java.lang.Object




© 2015 - 2025 Weber Informatics LLC | Privacy Policy