|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.restlet.security.Role
public class Role
Application specific role. Common examples are "administrator", "user",
"anonymous", "supervisor". Note that for reusability purpose, it is
recommended that those role don't reflect an actual organization, but more
the functional requirements of your application.
Two roles are considered equals if they belong to the same parent application
and have the same name and child roles. The description isn't used for
equality assessment.
Since version 2.2, they don't need to be the same Java objects anymore. In
order to prevent the multiplication of equivalent Role
instances, you
should try to call Application.getRole(String)
method.
Field Summary | |
---|---|
static Role |
ALL
Deprecated. To be removed as it is ambiguous, roles being specific to a given application. |
Constructor Summary | |
---|---|
Role()
Default constructor. |
|
Role(Application application,
java.lang.String name)
Constructor. |
|
Role(Application application,
java.lang.String name,
java.lang.String description)
Constructor. |
|
Role(java.lang.String name)
Deprecated. Use Role(Application, String) instead. |
|
Role(java.lang.String name,
java.lang.String description)
Deprecated. Use Role(Application, String, String) instead. |
Method Summary | |
---|---|
boolean |
equals(java.lang.Object o)
|
static Role |
get(Application application,
java.lang.String name)
Finds an existing role or creates a new one if needed. |
static Role |
get(Application application,
java.lang.String name,
java.lang.String description)
Finds an existing role or creates a new one if needed. |
Application |
getApplication()
Returns the parent application. |
java.util.List<Role> |
getChildRoles()
Returns the modifiable list of child roles. |
java.lang.String |
getDescription()
Returns the description. |
java.lang.String |
getName()
Returns the name. |
int |
hashCode()
|
void |
setApplication(Application application)
Sets the parent application. |
void |
setChildRoles(java.util.List<Role> childRoles)
Sets the modifiable list of child roles. |
void |
setDescription(java.lang.String description)
Sets the description. |
void |
setName(java.lang.String name)
Sets the name. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
@Deprecated public static final Role ALL
Constructor Detail |
---|
public Role()
Application.getCurrent()
method if available or is null.
public Role(Application application, java.lang.String name)
application
- The parent application or null.name
- The name.public Role(Application application, java.lang.String name, java.lang.String description)
application
- The parent application or null.name
- The name.description
- The description.@Deprecated public Role(java.lang.String name)
Role(Application, String)
instead.
Application.getCurrent()
method.
name
- The name.@Deprecated public Role(java.lang.String name, java.lang.String description)
Role(Application, String, String)
instead.
Application.getCurrent()
method.
name
- The name.description
- The description.Method Detail |
---|
public static Role get(Application application, java.lang.String name)
application
- The parent application.name
- The role name to find or create.
public static Role get(Application application, java.lang.String name, java.lang.String description)
application
- The parent application.name
- The role name to find or create.description
- The role description if one needs to be created.
public boolean equals(java.lang.Object o)
equals
in interface java.security.Principal
equals
in class java.lang.Object
public Application getApplication()
public java.util.List<Role> getChildRoles()
public java.lang.String getDescription()
public java.lang.String getName()
getName
in interface java.security.Principal
public int hashCode()
hashCode
in interface java.security.Principal
hashCode
in class java.lang.Object
public void setApplication(Application application)
application
- The parent application.public void setChildRoles(java.util.List<Role> childRoles)
childRoles
- A list of child roles.public void setDescription(java.lang.String description)
description
- The description.public void setName(java.lang.String name)
name
- The name.public java.lang.String toString()
toString
in interface java.security.Principal
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |