Class GroupImpl

  • All Implemented Interfaces:
    Group, Principal

    public class GroupImpl
    extends Object
    implements Group
    This class implements a group of principals.
    Author:
    Satish Dharmaraj
    • Constructor Detail

      • GroupImpl

        public GroupImpl​(String groupName)
        Constructs a Group object with no members.
        Parameters:
        groupName - the name of the group
    • Method Detail

      • addMember

        public boolean addMember​(Principal user)
        adds the specified member to the group.
        Specified by:
        addMember in interface Group
        Parameters:
        user - The principal to add to the group.
        Returns:
        true if the member was added - false if the member could not be added.
      • removeMember

        public boolean removeMember​(Principal user)
        Removes the specified member from the group.
        Specified by:
        removeMember in interface Group
        Parameters:
        user - The principal to remove from the group.
        Returns:
        true if the principal was removed false if the principal was not a member
      • equals

        public boolean equals​(Object obj)
        This function returns true if the group passed matches the group represented in this interface.
        Specified by:
        equals in interface Principal
        Overrides:
        equals in class Object
        Parameters:
        obj - the group to compare this group to.
      • isMember

        public boolean isMember​(Principal member)
        returns true if the passed principal is a member of the group.
        Specified by:
        isMember in interface Group
        Parameters:
        member - The principal whose membership must be checked for.
        Returns:
        true if the principal is a member of this group, false otherwise