Class NamePrincipal
- java.lang.Object
-
- org.wildfly.security.auth.principal.NamePrincipal
-
- All Implemented Interfaces:
Serializable
,Principal
public final class NamePrincipal extends Object implements Principal, Serializable
A principal which is comprised of a simpleString
name.- Author:
- David M. Lloyd
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private String
name
private static long
serialVersionUID
-
Constructor Summary
Constructors Constructor Description NamePrincipal(String name)
Construct a new instance.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object obj)
Determine whether this principal is equal to the given object.boolean
equals(NamePrincipal obj)
Determine whether this principal is equal to the given object.static NamePrincipal
from(Principal principal)
Attempt to convert the given principal to aNamePrincipal
.String
getName()
Get the principal name.int
hashCode()
Get the hash code of this principal.static boolean
isConvertibleTo(Principal principal)
Check if the given principal could be converted to aNamePrincipal
.String
toString()
Get a string representation of this principal.
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
name
private final String name
-
-
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.
-
hashCode
public int hashCode()
Get the hash code of this principal.
-
equals
public boolean equals(Object obj)
Determine whether this principal is equal to the given object.
-
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.
-
from
public static NamePrincipal from(Principal principal)
Attempt to convert the given principal to aNamePrincipal
.- Parameters:
principal
- the original principal- Returns:
- the
NamePrincipal
ornull
if the principal cannot be converted
-
isConvertibleTo
public static boolean isConvertibleTo(Principal principal)
Check if the given principal could be converted to aNamePrincipal
.- Parameters:
principal
- the original principal- Returns:
true
if the principal can be converted to aNamePrincipal
andfalse
otherwise
-
-