public final class IdUtils extends Object
Modifier and Type | Field and Description |
---|---|
static String |
UUID_TYPE_4_REGEXP |
Modifier and Type | Method and Description |
---|---|
static String |
generateId(String s,
String wordSeparator,
boolean lower,
int maxChars)
Generates an id from a non-null String.
|
static long |
generateLongId()
Generates an unique long identifier.
|
static String |
generateStringId()
Generates an unique string identifier.
|
static boolean |
isValidUUID(String uuid)
Check if a given string has the pattern for UUID type 4
|
public static final String UUID_TYPE_4_REGEXP
public static String generateStringId()
public static long generateLongId()
public static String generateId(String s, String wordSeparator, boolean lower, int maxChars)
Replaces accented characters from a string by their ascii equivalent, removes non alphanumerical characters and replaces spaces by the given wordSeparator character.
s
- the original StringwordSeparator
- the word separator to use (usually '-')lower
- if lower is true, remove upper casemaxChars
- maximum longer of identifier characterspublic static boolean isValidUUID(String uuid)
Copyright © 2018 Nuxeo. All rights reserved.