org.glassfish.security.common
Class PrincipalImpl

java.lang.Object
  extended by org.glassfish.security.common.PrincipalImpl
All Implemented Interfaces:
java.io.Serializable, java.security.Principal
Direct Known Subclasses:
FileRealmHelper.User, Group

public class PrincipalImpl
extends java.lang.Object
implements java.security.Principal, java.io.Serializable

This class implements the principal interface.

Author:
Harish Prabandham
See Also:
Serialized Form

Constructor Summary
PrincipalImpl(java.lang.String user)
          Construct a principal from a string user name.
 
Method Summary
 boolean equals(java.lang.Object another)
          This function returns true if the object passed matches the principal represented in this implementation
 java.lang.String getName()
          Gets the name of the Principal as a java.lang.String
 int hashCode()
          Returns the hashcode for this Principal object
 java.lang.String toString()
          Prints a stringified version of the principal.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PrincipalImpl

public PrincipalImpl(java.lang.String user)
Construct a principal from a string user name.

Parameters:
user - The string form of the principal name.
Method Detail

equals

public boolean equals(java.lang.Object another)
This function returns true if the object passed matches the principal represented in this implementation

Specified by:
equals in interface java.security.Principal
Overrides:
equals in class java.lang.Object
Parameters:
another - the Principal to compare with.
Returns:
true if the Principal passed is the same as that encapsulated in this object, false otherwise

toString

public java.lang.String toString()
Prints a stringified version of the principal.

Specified by:
toString in interface java.security.Principal
Overrides:
toString in class java.lang.Object
Returns:
A java.lang.String object returned by the method getName()

hashCode

public int hashCode()
Returns the hashcode for this Principal object

Specified by:
hashCode in interface java.security.Principal
Overrides:
hashCode in class java.lang.Object
Returns:
a hashcode for the principal.

getName

public java.lang.String getName()
Gets the name of the Principal as a java.lang.String

Specified by:
getName in interface java.security.Principal
Returns:
the name of the principal.


Copyright © 2012 GlassFish Community. All Rights Reserved.