public class User extends java.lang.Object
PresenceChannel.| Constructor and Description |
|---|
User(java.lang.String id,
java.lang.String jsonData)
Create a new user.
|
| 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() |
public User(java.lang.String id, java.lang.String jsonData)
id - The user idjsonData - The user JSON datapublic java.lang.String getId()
public java.lang.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
V - The class of the infoclazz - the class into which the user info JSON representation should
be parsed.public java.lang.String toString()
toString in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object other)
equals in class java.lang.Object