Class NumericPrincipal
java.lang.Object
org.wildfly.security.auth.principal.NumericPrincipal
- All Implemented Interfaces:
Serializable,Principal
A principal which is represented by a numeric ID, such as what a database might use for a primary key.
- Author:
- David M. Lloyd
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionNumericPrincipal(long id) Construct a new instance.Construct a new instance from a decimal string. -
Method Summary
Modifier and TypeMethodDescriptionbooleanDetermine whether this principal is equal to the given object.booleanequals(NumericPrincipal obj) Determine whether this principal is equal to the given object.longgetId()Get the ID of the principal.getName()Returns the name of this principal, which is just the string representation of the ID.inthashCode()Get the hash code of this principal.toString()Get this principal as a string.
-
Constructor Details
-
NumericPrincipal
public NumericPrincipal(long id) Construct a new instance.- Parameters:
id- the ID of the principal
-
NumericPrincipal
Construct a new instance from a decimal string.- Parameters:
id- the ID of the principal, as a string- Throws:
NumberFormatException- if the number is not a valid non-negative long integer
-
-
Method Details
-
getId
public long getId()Get the ID of the principal.- Returns:
- the ID of the principal
-
equals
Determine whether this principal is equal to the given object. -
equals
Determine whether this principal is equal to the given object.- Parameters:
obj- the object- Returns:
trueif they are equal,falseotherwise
-
hashCode
public int hashCode()Get the hash code of this principal. -
toString
Get this principal as a string. -
getName
Returns the name of this principal, which is just the string representation of the ID.
-