Class UserPrincipal

java.lang.Object
com.sun.grid.security.login.UserPrincipal
All Implemented Interfaces:
Serializable, Principal

public class UserPrincipal extends Object implements Principal, Serializable
Generic principal for a logged in user.
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    Create a UserPrincipal with a username.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Compares the specified Object with this UserPrincipal for equality.
    Return the username for this UserPrincipal.
    int
    Return a hash code for this UserPrincipal.
    Return a string representation of this UserPrincipal.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait

    Methods inherited from interface java.security.Principal

    implies
  • Constructor Details

    • UserPrincipal

      public UserPrincipal(String name)
      Create a UserPrincipal with a username.

      Parameters:
      name - the username for this user.
      Throws:
      NullPointerException - if the name is null.
  • Method Details

    • getName

      public String getName()
      Return the username for this UserPrincipal.

      Specified by:
      getName in interface Principal
      Returns:
      the username for this UserPrincipal
    • toString

      public String toString()
      Return a string representation of this UserPrincipal.

      Specified by:
      toString in interface Principal
      Overrides:
      toString in class Object
      Returns:
      a string representation of this UserPrincipal.
    • equals

      public boolean equals(Object o)
      Compares the specified Object with this UserPrincipal for equality. Returns true if the given object is also a UserPrincipal and the two UserPrincipals have the same username.

      Specified by:
      equals in interface Principal
      Overrides:
      equals in class Object
      Parameters:
      o - Object to be compared for equality with this UserPrincipal.
      Returns:
      true if the specified Object is equal equal to this UserPrincipal.
    • hashCode

      public int hashCode()
      Return a hash code for this UserPrincipal.

      Specified by:
      hashCode in interface Principal
      Overrides:
      hashCode in class Object
      Returns:
      a hash code for this UserPrincipal.