org.restlet.security
Class Role

java.lang.Object
  extended by org.restlet.security.Role
All Implemented Interfaces:
Principal

public class Role
extends Object
implements Principal

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. Also, two roles are not considered equals if they have the same the name and child roles, they need to be the same Java object. If you need to reuse the same role, you should call Application.getRole(String) method instead.

Author:
Jerome Louvel

Field Summary
static Role ALL
          Unmodifiable role that covers all existing roles.
 
Constructor Summary
Role()
          Default constructor.
Role(String name)
          Constructor.
Role(String name, String description)
          Constructor.
 
Method Summary
 List<Role> getChildRoles()
          Returns the modifiable list of child roles.
 String getDescription()
          Returns the description.
 String getName()
          Returns the name.
 void setChildRoles(List<Role> childRoles)
          Sets the modifiable list of child roles.
 void setDescription(String description)
          Sets the description.
 void setName(String name)
          Sets the name.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.security.Principal
equals, hashCode
 

Field Detail

ALL

public static final Role ALL
Unmodifiable role that covers all existing roles. Its name is "*" by convention.

Constructor Detail

Role

public Role()
Default constructor.


Role

public Role(String name)
Constructor.

Parameters:
name - The name.

Role

public Role(String name,
            String description)
Constructor.

Parameters:
name - The name.
description - The description.
Method Detail

getChildRoles

public List<Role> getChildRoles()
Returns the modifiable list of child roles.

Returns:
The modifiable list of child roles.

getDescription

public String getDescription()
Returns the description.

Returns:
The description.

getName

public String getName()
Returns the name.

Specified by:
getName in interface Principal
Returns:
The name.

setChildRoles

public void setChildRoles(List<Role> childRoles)
Sets the modifiable list of child roles. This method clears the current list and adds all entries in the parameter list.

Parameters:
childRoles - A list of child roles.

setDescription

public void setDescription(String description)
Sets the description.

Parameters:
description - The description.

setName

public void setName(String name)
Sets the name.

Parameters:
name - The name.

toString

public String toString()
Specified by:
toString in interface Principal
Overrides:
toString in class Object


Copyright © 2005-2013 Restlet.