FileDocCategorySizeDatePackage
PrincipalImpl.javaAPI DocGlassfish v2 API3740Fri May 04 22:31:22 BST 2007com.sun.enterprise.deployment

PrincipalImpl

public class PrincipalImpl extends Object implements Principal, Serializable
This class implements the principal interface.
author
Harish Prabandham

Fields Summary
private String
name
Constructors Summary
public PrincipalImpl(String user)
Construct a principal from a string user name.

param
user The string form of the principal name.

	this.name = user;
    
Methods Summary
public booleanequals(java.lang.Object another)
This function returns true if the object passed matches the principal represented in this implementation

param
another the Principal to compare with.
return
true if the Principal passed is the same as that encapsulated in this object, false otherwise

        // XXX for bug 4889642: if groupA and userA have
        // the same name, then groupA.equals(userA) return false
        // BUT userA.equals(groupA) return "true"
        if (another instanceof Group) {
            return false;
        } else if (another instanceof PrincipalImpl) {
	    Principal p = (Principal) another;
	    return getName().equals(p.getName());
	} else
	    return false;
    
public java.lang.StringgetName()
Gets the name of the Principal as a java.lang.String

return
the name of the principal.

	return name;
    
public inthashCode()
Returns the hashcode for this Principal object

return
a hashcode for the principal.

	return name.hashCode();
    
public java.lang.StringtoString()
Prints a stringified version of the principal.

return
A java.lang.String object returned by the method getName()

	return getName();