Class NamePrincipal

    • Constructor Detail

      • NamePrincipal

        public NamePrincipal​(String name)
        Construct a new instance.
        Parameters:
        name - the principal name
    • Method Detail

      • getName

        public String getName()
        Get the principal name.
        Specified by:
        getName in interface Principal
        Returns:
        the principal name
      • hashCode

        public int hashCode()
        Get the hash code of this principal.
        Specified by:
        hashCode in interface Principal
        Overrides:
        hashCode in class Object
        Returns:
        the hash code of this principal
      • equals

        public boolean equals​(Object obj)
        Determine whether this principal is equal to the given object.
        Specified by:
        equals in interface Principal
        Overrides:
        equals in class Object
        Parameters:
        obj - the object
        Returns:
        true if they are equal, false otherwise
      • equals

        public boolean equals​(NamePrincipal obj)
        Determine whether this principal is equal to the given object.
        Parameters:
        obj - the object
        Returns:
        true if they are equal, false otherwise
      • toString

        public String toString()
        Get a string representation of this principal.
        Specified by:
        toString in interface Principal
        Overrides:
        toString in class Object
        Returns:
        the string representation of this principal
      • from

        public static NamePrincipal from​(Principal principal)
        Attempt to convert the given principal to a NamePrincipal.
        Parameters:
        principal - the original principal
        Returns:
        the NamePrincipal or null if the principal cannot be converted
      • isConvertibleTo

        public static boolean isConvertibleTo​(Principal principal)
        Check if the given principal could be converted to a NamePrincipal.
        Parameters:
        principal - the original principal
        Returns:
        true if the principal can be converted to a NamePrincipal and false otherwise