info.magnolia.cms.security.auth
Class PrincipalCollectionImpl

java.lang.Object
  extended by info.magnolia.cms.security.auth.PrincipalCollectionImpl
All Implemented Interfaces:
PrincipalCollection, Serializable, Iterable<Principal>, Principal

public class PrincipalCollectionImpl
extends Object
implements PrincipalCollection

Principal collection implementation based on simple list. Collection is managed externally. Date: Jun 29, 2005

Author:
Sameer Charles $Id: PrincipalCollectionImpl.java 50229 2011-10-20 16:10:16Z tmattsson $
See Also:
Serialized Form

Constructor Summary
PrincipalCollectionImpl()
           
 
Method Summary
 void add(Principal principal)
          Adds principal to the internal collection of principals.
 void addAll(Collection<Principal> principal)
          Adds principals to the internal collection of principals.
 void clearAll()
          removes all principals from the collection.
 boolean contains(Principal principal)
          Checks if this collection contains specified principal.
 boolean contains(String name)
          Checks if this collection contains principal with the specified name.
 Principal get(String name)
          Gets principal associated to the specified name from the collection.
 String getName()
          Gets name given to this principal.
 Iterator<Principal> iterator()
          Returns an iterator over the collection of principals.
 void remove(Principal principal)
          Removes principal from the collection if present or does nothing in case principal was not present in the collection.
 void set(Collection<Principal> collection)
          Deprecated. since 4.5
 void setName(String name)
          Sets this principal name.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.security.Principal
equals, hashCode
 

Constructor Detail

PrincipalCollectionImpl

public PrincipalCollectionImpl()
Method Detail

getName

public String getName()
Gets name given to this principal.

Specified by:
getName in interface PrincipalCollection
Specified by:
getName in interface Principal
Returns:
name

setName

public void setName(String name)
Sets this principal name.

Specified by:
setName in interface PrincipalCollection

set

@Deprecated
public void set(Collection<Principal> collection)
Deprecated. since 4.5

Sets internal collection of principals.

Specified by:
set in interface PrincipalCollection

add

public void add(Principal principal)
Adds principal to the internal collection of principals.

Specified by:
add in interface PrincipalCollection
Parameters:
principal - to be added to the collection

addAll

public void addAll(Collection<Principal> principal)
Adds principals to the internal collection of principals.

Specified by:
addAll in interface PrincipalCollection
Parameters:
principal - to be added to the collection

remove

public void remove(Principal principal)
Removes principal from the collection if present or does nothing in case principal was not present in the collection.

Specified by:
remove in interface PrincipalCollection
Parameters:
principal - to be removed from the collection

clearAll

public void clearAll()
removes all principals from the collection.

Specified by:
clearAll in interface PrincipalCollection

contains

public boolean contains(Principal principal)
Checks if this collection contains specified principal.

Specified by:
contains in interface PrincipalCollection
Returns:
true if the specified object exist in the collection, false otherwise.

contains

public boolean contains(String name)
Checks if this collection contains principal with the specified name.

Specified by:
contains in interface PrincipalCollection
Parameters:
name -
Returns:
true if the collection contains the principal by the specified name, false otherwise.

get

public Principal get(String name)
Gets principal associated to the specified name from the collection.

Specified by:
get in interface PrincipalCollection
Parameters:
name -
Returns:
principal object associated to the specified name.

iterator

public Iterator<Principal> iterator()
Returns an iterator over the collection of principals.

Specified by:
iterator in interface PrincipalCollection
Specified by:
iterator in interface Iterable<Principal>
Returns:
iterator for Principal objects

toString

public String toString()
Specified by:
toString in interface Principal
Overrides:
toString in class Object
See Also:
Object.toString()


Copyright © 2003-2012 Magnolia International Ltd.. All Rights Reserved.