org.jboss.security
Class SimpleGroup
java.lang.Object
org.jboss.security.SimplePrincipal
org.jboss.security.SimpleGroup
- All Implemented Interfaces:
- Serializable, Cloneable, Group, Principal
public class SimpleGroup
- extends SimplePrincipal
- implements Group, Cloneable
- See Also:
- Serialized Form
SimpleGroup
public SimpleGroup(String groupName)
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 this group.
- Returns:
- true if the member was successfully added,
false if the principal was already a member.
isMember
public boolean isMember(Principal member)
- Returns true if the passed principal is a member of the group.
This method does a recursive search, so if a principal belongs to a
group which is a member of this group, true is returned.
A special check is made to see if the member is an instance of
org.jboss.security.AnybodyPrincipal or org.jboss.security.NobodyPrincipal
since these classes do not hash to meaningful values.
- Specified by:
isMember
in interface Group
- Parameters:
member
- the principal whose membership is to be checked.
- Returns:
- true if the principal is a member of this group,
false otherwise.
members
public Enumeration<Principal> members()
- Returns an enumeration of the members in the group.
The returned objects can be instances of either Principal
or Group (which is a subinterface of Principal).
- Specified by:
members
in interface Group
- Returns:
- an enumeration of the group members.
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 this group.
- Returns:
- true if the principal was removed, or
false if the principal was not a member.
toString
public String toString()
- Specified by:
toString
in interface Principal
- Overrides:
toString
in class SimplePrincipal
clone
public Object clone()
throws CloneNotSupportedException
- Overrides:
clone
in class Object
- Throws:
CloneNotSupportedException
Copyright © 2009 JBoss Inc.. All Rights Reserved.