Class UserPrincipal

  • All Implemented Interfaces:
    java.io.Serializable, java.security.Principal

    public class UserPrincipal
    extends java.lang.Object
    implements java.security.Principal, java.io.Serializable
    Generic principal for a logged in user.
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      UserPrincipal​(java.lang.String name)
      Create a UserPrincipal with a username.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object o)
      Compares the specified Object with this UserPrincipal for equality.
      java.lang.String getName()
      Return the username for this UserPrincipal.
      int hashCode()
      Return a hash code for this UserPrincipal.
      java.lang.String toString()
      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 Detail

      • UserPrincipal

        public UserPrincipal​(java.lang.String name)
        Create a UserPrincipal with a username.

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

      • getName

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

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

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

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

        public boolean equals​(java.lang.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 java.security.Principal
        Overrides:
        equals in class java.lang.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 java.security.Principal
        Overrides:
        hashCode in class java.lang.Object
        Returns:
        a hash code for this UserPrincipal.