public final class CompositePrincipal extends Object implements Principal, Serializable, Iterable<Principal>
Constructor and Description |
---|
CompositePrincipal(Collection<Principal> principals)
Construct a new instance.
|
CompositePrincipal(Principal... principals)
Construct a new instance.
|
Modifier and Type | Method and Description |
---|---|
boolean |
contains(Class<? extends Principal> type)
Determine whether this composite principal contains the a nested principal of the given type class.
|
boolean |
contains(Principal principal)
Determine whether this composite principal contains the given nested principal.
|
boolean |
equals(CompositePrincipal obj)
Determine whether this principal is equal to the given object.
|
boolean |
equals(Object obj)
Determine whether this principal is equal to the given object.
|
<P extends Principal> |
get(Class<P> type)
Get the first principal with the given type, if any.
|
Principal |
get(int idx)
Get the principal at the given index.
|
<P extends Principal> |
get(int idx,
Class<P> type)
Get the principal at the given index, if it is of the given type.
|
String |
getName()
Get the principal name.
|
int |
hashCode()
Get the hash code of this principal.
|
Iterator<Principal> |
iterator()
Get an iterator over this principal.
|
int |
size()
Get the number of nested principals.
|
String |
toString()
Get this principal as a string.
|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
forEach, spliterator
public CompositePrincipal(Collection<Principal> principals)
principals
- the collection of principals to use (must not be null
)public CompositePrincipal(Principal... principals)
principals
- the principals to use (must not be null
)public String getName()
public boolean contains(Principal principal)
principal
- the nested principal (must not be null
)true
if this principal contains the nested principal, false
otherwisepublic boolean contains(Class<? extends Principal> type)
type
- the nested principal type class (must not be null
)true
if this principal contains a nested principal of the given type, false
otherwisepublic int size()
public Principal get(int idx)
idx
- the indexnull
)IndexOutOfBoundsException
- if the given index is less than zero or greater than or equal to size()
public <P extends Principal> P get(int idx, Class<P> type)
P
- the principal typeidx
- the indextype
- the principal type class (must not be null
)null
if that principal is not of the given typeIndexOutOfBoundsException
- if the given index is less than zero or greater than or equal to size()
public <P extends Principal> P get(Class<P> type)
P
- the principal typetype
- the principal type class (must not be null
)null
if none was foundIndexOutOfBoundsException
- if the given index is less than zero or greater than or equal to size()
public boolean equals(Object obj)
public boolean equals(CompositePrincipal obj)
obj
- the objecttrue
if they are equal, false
otherwisepublic int hashCode()
Copyright © 2020 JBoss by Red Hat. All rights reserved.