org.restlet.security

## Class Role

- java.lang.Object
- - org.restlet.security.Role

All Implemented Interfaces:
  java.security.Principal

    public class Role
    extends java.lang.Object
    implements java.security.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.

Author:
  Jerome Louvel

### Field Summary

Fields
`static Role` `ALL` Unmodifiable role that covers all existing roles.

### Constructor Summary

Constructors
Constructor and Description
`Role()` Default constructor.
`Role(java.lang.String name, java.lang.String description)` Constructor.

### Method Summary

Methods
`boolean` `equals(java.lang.Object target)`
`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` `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

#### 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(java.lang.String name,
        java.lang.String description)

Constructor.

Parameters:
  `name` - The name.
  `description` - The description.

### Method Detail

#### equals

    public boolean equals(java.lang.Object target)

Specified by:
  `equals` in interface `java.security.Principal`
Overrides:
  `equals` in class `java.lang.Object`

#### getChildRoles

    public java.util.List<Role> getChildRoles()

Returns the modifiable list of child roles.

Returns:
  The modifiable list of child roles.

#### getDescription

    public java.lang.String getDescription()

Returns the description.

Returns:
  The description.

#### getName

    public java.lang.String getName()

Returns the name.

Specified by:
  `getName` in interface `java.security.Principal`
Returns:
  The name.

#### hashCode

    public int hashCode()

Specified by:
  `hashCode` in interface `java.security.Principal`
Overrides:
  `hashCode` in class `java.lang.Object`

#### setChildRoles

    public void setChildRoles(java.util.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(java.lang.String description)

Sets the description.

Parameters:
  `description` - The description.

#### setName

    public void setName(java.lang.String name)

Sets the name.

Parameters:
  `name` - The name.

#### toString

    public java.lang.String toString()

Specified by:
  `toString` in interface `java.security.Principal`
Overrides:
  `toString` in class `java.lang.Object`