Identifier
, Comparable<Identifier>
, net.minidev.json.JSONAware
public final class Username extends BaseIdentifier
The isLegal(java.lang.String)
method is intended for basic validation before
committing to expensive operations such as authentication. It checks whether
the specified string falls outside the typical scope of legal username
characters and length.
Modifier and Type | Field | Description |
---|---|---|
static String |
LEGAL_USERNAME_RE |
The regular expression string used to match legal usernames.
|
DEFAULT_BYTE_LENGTH, SECURE_RANDOM
Constructor | Description |
---|---|
Username(String value) |
Creates a new username.
|
Modifier and Type | Method | Description |
---|---|---|
boolean |
equals(Object object) |
Overrides
Object.equals() . |
static boolean |
isLegal(String value) |
Checks whether the specified username value is legal.
|
static boolean |
isLegal(String value,
Pattern re) |
Checks whether the specified username value is legal.
|
compareTo, hashCode, toJSONString, toString
public static final String LEGAL_USERNAME_RE
public static boolean isLegal(String value)
LEGAL_USERNAME_RE
.value
- The username value to test. It is trimmed before
testing. Must not be null
.true
if the username is legal, else false
.public static boolean isLegal(String value, Pattern re)
value
- The username value to test. It is trimmed before
testing. Must not be null
.re
- The regular expression for validation, must evaluate to
true
for a legal username value.true
if the username is legal, else false
.public boolean equals(Object object)
BaseIdentifier
Object.equals()
.equals
in class BaseIdentifier
object
- The object to compare to.true
if the objects have the same value, otherwise
false
.Copyright © 2018 Connect2id. All rights reserved.