AbstractGroup (Apache Tomcat 9.0.83 API Documentation)
Description: declaration: package: org.apache.catalina.users, class: AbstractGroup

Package org.apache.catalina.users

# Class AbstractGroup

java.lang.Object
org.apache.catalina.users.AbstractGroup

All Implemented Interfaces:
  `Principal`, `Group`

Direct Known Subclasses:
  `GenericGroup`

public abstract class AbstractGroup extends Object implements Group

Convenience base class for `Group` implementations.

Since:
  4.1
Author:
  Craig R. McClanahan

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected String`
  `description`
  The description of this group.
  `protected String`
  `groupname`
  The group name of this group.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `AbstractGroup()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `abstract void`
  `addRole(Role role)`
  Add a new `Role` to those assigned specifically to this group.
  `String`
  `getDescription()`
  Return the description of this group.
  `String`
  `getGroupname()`
  Return the group name of this group, which must be unique within the scope of a `UserDatabase`.
  `String`
  `getName()`
  Make the principal name the same as the group name.
  `abstract Iterator<Role>`
  `getRoles()`
  Return the set of `Role`s assigned specifically to this group.
  `abstract UserDatabase`
  `getUserDatabase()`
  Return the `UserDatabase` within which this Group is defined.
  `abstract Iterator<User>`
  `getUsers()`
  Return an Iterator over the set of `User`s that are members of this group.
  `abstract boolean`
  `isInRole(Role role)`
  Is this group specifically assigned the specified `Role`?
  `abstract void`
  `removeRole(Role role)`
  Remove a `Role` from those assigned to this group.
  `abstract void`
  `removeRoles()`
  Remove all `Role`s from those assigned to this group.
  `void`
  `setDescription(String description)`
  Set the description of this group.
  `void`
  `setGroupname(String groupname)`
  Set the group name of this group, which must be unique within the scope of a `UserDatabase`.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

  ### Methods inherited from interface java.security.Principal

  `equals, hashCode, implies, toString`

- ## Field Details

  - ### description

    protected String description
    The description of this group.

  - ### groupname

    protected String groupname
    The group name of this group.

- ## Constructor Details

  - ### AbstractGroup

    public AbstractGroup()

- ## Method Details

  - ### getDescription

    public String getDescription()
    Return the description of this group.
    Specified by:
      `getDescription` in interface `Group`
    Returns:
      the description of this group.

  - ### setDescription

    public void setDescription(String description)
    Set the description of this group.
    Specified by:
      `setDescription` in interface `Group`
    Parameters:
      `description` - The new description

  - ### getGroupname

    public String getGroupname()
    Return the group name of this group, which must be unique within the scope of a `UserDatabase`.
    Specified by:
      `getGroupname` in interface `Group`
    Returns:
      the group name of this group, which must be unique within the scope of a `UserDatabase`.

  - ### setGroupname

    public void setGroupname(String groupname)
    Set the group name of this group, which must be unique within the scope of a `UserDatabase`.
    Specified by:
      `setGroupname` in interface `Group`
    Parameters:
      `groupname` - The new group name

  - ### getRoles

    public abstract Iterator<Role> getRoles()
    Return the set of `Role`s assigned specifically to this group.
    Specified by:
      `getRoles` in interface `Group`
    Returns:
      the set of `Role`s assigned specifically to this group.

  - ### getUserDatabase

    public abstract UserDatabase getUserDatabase()
    Return the `UserDatabase` within which this Group is defined.
    Specified by:
      `getUserDatabase` in interface `Group`
    Returns:
      the `UserDatabase` within which this Group is defined.

  - ### getUsers

    public abstract Iterator<User> getUsers()
    Return an Iterator over the set of `User`s that are members of this group.
    Specified by:
      `getUsers` in interface `Group`
    Returns:
      the set of `User`s that are members of this group.

  - ### addRole

    public abstract void addRole(Role role)
    Add a new `Role` to those assigned specifically to this group.
    Specified by:
      `addRole` in interface `Group`
    Parameters:
      `role` - The new role

  - ### isInRole

    public abstract boolean isInRole(Role role)
    Is this group specifically assigned the specified `Role`?
    Specified by:
      `isInRole` in interface `Group`
    Parameters:
      `role` - The role to check
    Returns:
      `true` if the group is assigned to the specified role otherwise `false`

  - ### removeRole

    public abstract void removeRole(Role role)
    Remove a `Role` from those assigned to this group.
    Specified by:
      `removeRole` in interface `Group`
    Parameters:
      `role` - The old role

  - ### removeRoles

    public abstract void removeRoles()
    Remove all `Role`s from those assigned to this group.
    Specified by:
      `removeRoles` in interface `Group`

  - ### getName

    public String getName()
    Make the principal name the same as the group name.
    Specified by:
      `getName` in interface `Principal`