public final class PrecisProfiles extends Object
PrecisProfiles.USERNAME_CASE_MAPPED.prepare("UpperCaseUsername");
If the passed string contains any invalid characters, an InvalidCodePointException is thrown:
PrecisProfiles.USERNAME_CASE_MAPPED.prepare("Usernameā"); // Contains symbol, throws exception.
String enforced = PrecisProfiles.USERNAME_CASE_MAPPED.enforce("UpperCaseUsername"); // uppercaseusername
String.equals() on two enforced strings to determine if they are equivalent,
e.g.:
PrecisProfile profile = PrecisProfiles.USERNAME_CASE_MAPPED;
if (profile.enforce("foobar").equals(profile.enforce("FooBar"))) {
// username already exists.
}
However, using PrecisProfile.compare(CharSequence, CharSequence) is preferable, because a profile may use different rules during comparison than during enforcement (as the Nickname profile, RFC 7700):
if (profile.compare("foobar", "FooBar") == 0) {
// username already exists.
}
Also note that PrecisProfile implements Comparator.PrecisProfile| Modifier and Type | Field and Description |
|---|---|
static PrecisProfile |
NICKNAME
The "Nickname Profile" specified in "Preparation, Enforcement, and Comparison
of Internationalized Strings Representing Nicknames", RFC 7700.
|
static PrecisProfile |
OPAQUE_STRING
The "OpaqueString Profile" specified in "Preparation, Enforcement, and Comparison of Internationalized Strings
Representing Usernames and Passwords", RFC 7613.
|
static PrecisProfile |
USERNAME_CASE_MAPPED
The "UsernameCaseMapped Profile" specified in "Preparation, Enforcement, and Comparison of Internationalized Strings
Representing Usernames and Passwords", RFC 7613.
|
static PrecisProfile |
USERNAME_CASE_PRESERVED
The "UsernameCasePreserved Profile" specified in "Preparation, Enforcement, and Comparison of Internationalized Strings
Representing Usernames and Passwords", RFC 7613.
|
public static final PrecisProfile USERNAME_CASE_MAPPED
public static final PrecisProfile USERNAME_CASE_PRESERVED
public static final PrecisProfile OPAQUE_STRING
public static final PrecisProfile NICKNAME
Copyright © 2015–2016 XMPP.rocks. All rights reserved.