public class UserProfile extends Object implements Serializable, Externalizable, Clearable
| Modifier and Type | Field and Description |
|---|---|
protected static org.slf4j.Logger |
logger |
static String |
SEPARATOR |
| Constructor and Description |
|---|
UserProfile() |
| Modifier and Type | Method and Description |
|---|---|
void |
addAttribute(String key,
Object value)
Add an attribute and perform conversion if necessary.
|
void |
addAttributes(Map<String,Object> attributes)
Add attributes.
|
void |
addPermission(String permission)
Add a permission.
|
void |
addPermissions(List<String> permissions)
Add permissions.
|
void |
addRole(String role)
Add a role.
|
void |
addRoles(List<String> roles)
Add roles.
|
void |
build(Object id,
Map<String,Object> attributes)
Build a profile from user identifier and attributes.
|
void |
clear()
Removes any sensitive or unnecessary information held in the object.
|
Object |
getAttribute(String name)
Return the attribute with name.
|
<T> T |
getAttribute(String name,
Class<T> clazz)
Return the attribute with name.
|
Map<String,Object> |
getAttributes()
Get attributes as immutable map.
|
protected AttributesDefinition |
getAttributesDefinition()
Return the attributes definition for this user profile.
|
String |
getId()
Get the user identifier.
|
List<String> |
getPermissions()
Get the permissions of the user.
|
List<String> |
getRoles()
Get the roles of the user.
|
String |
getTypedId()
Get the user identifier with a prefix which is the profile type.
|
boolean |
isRemembered()
Is the user remembered?
|
void |
readExternal(ObjectInput in) |
void |
setId(Object id)
Set the identifier and convert it if necessary.
|
void |
setRemembered(boolean rme)
Define if this profile is remembered.
|
String |
toString() |
void |
writeExternal(ObjectOutput out) |
protected static final transient org.slf4j.Logger logger
public static final transient String SEPARATOR
public void build(Object id, Map<String,Object> attributes)
id - user identifierattributes - user attributesprotected AttributesDefinition getAttributesDefinition()
public void addAttribute(String key, Object value)
key - key of the attributevalue - value of the attributepublic void addAttributes(Map<String,Object> attributes)
attributes - use attributespublic void setId(Object id)
id - user identifierpublic String getId()
public String getTypedId()
public Map<String,Object> getAttributes()
public Object getAttribute(String name)
name - attribute namepublic <T> T getAttribute(String name, Class<T> clazz)
T - the type of the attributename - the attribute nameclazz - the class of the attributepublic void addRole(String role)
role - the role to add.public void addPermission(String permission)
permission - the permission to add.public void addPermissions(List<String> permissions)
permissions - the permissions to add.public void setRemembered(boolean rme)
rme - whether the user is remembered.public List<String> getPermissions()
public boolean isRemembered()
public void writeExternal(ObjectOutput out) throws IOException
writeExternal in interface ExternalizableIOExceptionpublic void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
readExternal in interface ExternalizableIOExceptionClassNotFoundExceptionCopyright © 2016. All Rights Reserved.