Package 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
An implementation of Group that manages a collection of Principal objects based on their hashCode() and equals() methods. This class is not thread safe.- Version:
- $Revision$
- Author:
- Scott.Stark@jboss.org
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description SimpleGroup(String groupName)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanaddMember(Principal user)Adds the specified member to the group.Objectclone()booleanisMember(Principal member)Returns true if the passed principal is a member of the group.Enumeration<Principal>members()Returns an enumeration of the members in the group.booleanremoveMember(Principal user)Removes the specified member from the group.StringtoString()-
Methods inherited from class org.jboss.security.SimplePrincipal
equals, getName, hashCode
-
-
-
-
Constructor Detail
-
SimpleGroup
public SimpleGroup(String groupName)
-
-
Method Detail
-
addMember
public boolean addMember(Principal user)
Adds the specified member to the group.
-
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.
-
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).
-
removeMember
public boolean removeMember(Principal user)
Removes the specified member from the group.- Specified by:
removeMemberin interfaceGroup- 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:
toStringin interfacePrincipal- Overrides:
toStringin classSimplePrincipal
-
clone
public Object clone() throws CloneNotSupportedException
- Overrides:
clonein classObject- Throws:
CloneNotSupportedException
-
-