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 simpleStringname.- Author:
- David M. Lloyd
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private Stringnameprivate static longserialVersionUID
-
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 booleanequals(Object obj)Determine whether this principal is equal to the given object.booleanequals(NamePrincipal obj)Determine whether this principal is equal to the given object.static NamePrincipalfrom(Principal principal)Attempt to convert the given principal to aNamePrincipal.StringgetName()Get the principal name.inthashCode()Get the hash code of this principal.static booleanisConvertibleTo(Principal principal)Check if the given principal could be converted to aNamePrincipal.StringtoString()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:
trueif they are equal,falseotherwise
-
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
NamePrincipalornullif 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:
trueif the principal can be converted to aNamePrincipalandfalseotherwise
-
-