org.apache.wiki.auth.login
Class PrincipalWrapper

java.lang.Object
  extended by org.apache.wiki.auth.login.PrincipalWrapper
All Implemented Interfaces:
Principal

public final class PrincipalWrapper
extends Object
implements Principal

Wrapper class for container-managed or externally-provided principals. Instances of PrincipalWrapper are immutable.

Since:
2.3

Constructor Summary
PrincipalWrapper(Principal principal)
          Constructs a new instance of this class by wrapping (decorating) the supplied principal.
 
Method Summary
 boolean equals(Object obj)
          Two PrincipalWrapper objects are equal if their internally-wrapped principals are also equal.
 String getName()
          Returns the name of the wrapped principal.
 Principal getPrincipal()
          Returns the wrapped Principal used to construct this instance.
 int hashCode()
          The hashcode is based on the hashcode of the wrapped principal.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.security.Principal
toString
 

Constructor Detail

PrincipalWrapper

public PrincipalWrapper(Principal principal)
Constructs a new instance of this class by wrapping (decorating) the supplied principal.

Parameters:
principal - The principal to wrap
Method Detail

getPrincipal

public Principal getPrincipal()
Returns the wrapped Principal used to construct this instance.

Returns:
the wrapped Principal decorated by this instance.

getName

public String getName()
Returns the name of the wrapped principal.

Specified by:
getName in interface Principal
Returns:
The name of the wrapped principal.

equals

public boolean equals(Object obj)
Two PrincipalWrapper objects are equal if their internally-wrapped principals are also equal.

Specified by:
equals in interface Principal
Overrides:
equals in class Object
Parameters:
obj -
Returns:
True, if the wrapped object is also equal to our wrapped object.

hashCode

public int hashCode()
The hashcode is based on the hashcode of the wrapped principal.

Specified by:
hashCode in interface Principal
Overrides:
hashCode in class Object
Returns:
A hashcode.


Copyright © {inceptionYear}-2014 The Apache Software Foundation. All rights reserved.