Package io.sentry.protocol
Class User
java.lang.Object
io.sentry.protocol.User
- All Implemented Interfaces:
JsonSerializable
,JsonUnknown
Information about the user who triggered an event.
```json { "user": { "id": "unique_id", "username": "my_user", "email": "foo@example.com", "ip_address": "127.0.0.1", "subscription": "basic" } } ```
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic final class
static final class
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
static User
fromMap
(@NotNull Map<String, Object> map, @NotNull SentryOptions options) Creates user from a map.getData()
Gets additional arbitrary fields of the user.@Nullable String
getEmail()
Gets the e-mail address of the user.@Nullable Geo
getGeo()
Get user geo location.@Nullable String
getId()
Gets the id of the user.@Nullable String
Gets the IP address of the user.@Nullable String
getName()
Get human readable name.Deprecated.@Nullable String
Deprecated.has no effect and will be removed in the next major update.@Nullable String
Gets the username of the user.int
hashCode()
void
serialize
(@NotNull ObjectWriter writer, @NotNull ILogger logger) void
Sets additional arbitrary fields of the user.void
Gets the e-mail address of the user.void
Set user geo location.void
Sets the id of the user.void
setIpAddress
(@Nullable String ipAddress) Sets the IP address of the user.void
Set human readable name.void
Deprecated.use {setData(Map)
} insteadvoid
setSegment
(@Nullable String segment) Deprecated.has no effect and will be removed in the next major update.void
setUnknown
(@Nullable Map<String, Object> unknown) void
setUsername
(@Nullable String username) Sets the username of the user.
-
Constructor Details
-
User
public User() -
User
-
-
Method Details
-
fromMap
public static User fromMap(@NotNull @NotNull Map<String, Object> map, @NotNull @NotNull SentryOptions options) Creates user from a map.The values `data` and `value` expect a
Map<String, String>
type. If other object types are in the map `toString()` will be called on them.- Parameters:
map
- - The user data as mapoptions
- - the sentry options- Returns:
- the user
-
getEmail
Gets the e-mail address of the user.- Returns:
- the e-mail.
-
setEmail
Gets the e-mail address of the user.- Parameters:
email
- the e-mail.
-
getId
Gets the id of the user.- Returns:
- the id.
-
setId
Sets the id of the user.- Parameters:
id
- the user id.
-
getUsername
Gets the username of the user.- Returns:
- the username.
-
setUsername
Sets the username of the user.- Parameters:
username
- the username.
-
getSegment
Deprecated.has no effect and will be removed in the next major update.Gets the segment of the user.- Returns:
- the user segment.
-
setSegment
Deprecated.has no effect and will be removed in the next major update.Sets the segment of the user.- Parameters:
segment
- the segment.
-
getIpAddress
Gets the IP address of the user.- Returns:
- the IP address of the user.
-
setIpAddress
Sets the IP address of the user.- Parameters:
ipAddress
- the IP address of the user.
-
getOthers
Deprecated.use {getData()
} insteadGets other user related data.- Returns:
- the other user data.
-
setOthers
Deprecated.use {setData(Map)
} insteadSets other user related data.- Parameters:
other
- the other user related data.
-
getName
Get human readable name.- Returns:
- Human readable name
-
setName
Set human readable name.- Parameters:
name
- Human readable name
-
getGeo
Get user geo location.- Returns:
- User geo location
-
setGeo
Set user geo location.- Parameters:
geo
- User geo location
-
getData
Gets additional arbitrary fields of the user.- Returns:
- the other user data.
-
setData
Sets additional arbitrary fields of the user.- Parameters:
data
- the other user related data.
-
equals
-
hashCode
public int hashCode() -
getUnknown
- Specified by:
getUnknown
in interfaceJsonUnknown
-
setUnknown
- Specified by:
setUnknown
in interfaceJsonUnknown
-
serialize
public void serialize(@NotNull @NotNull ObjectWriter writer, @NotNull @NotNull ILogger logger) throws IOException - Specified by:
serialize
in interfaceJsonSerializable
- Throws:
IOException
-
getData()
} instead