public final class IdUtils extends Object
Modifier and Type | Field and Description |
---|---|
static Pattern |
STUPID_REGEXP |
static String |
UUID_TYPE_4_REGEXP |
Modifier and Type | Method and Description |
---|---|
static String |
generateId(String s)
Deprecated.
use
generatePathSegment(java.lang.String) instead, or generateId(String, String, boolean, int)
depending on the use cases |
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 |
generatePathSegment(String s)
Deprecated.
use
PathSegmentService instead |
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 final Pattern STUPID_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 characters@Deprecated public static String generateId(String s)
generatePathSegment(java.lang.String)
instead, or generateId(String, String, boolean, int)
depending on the use casesUses default values for wordSeparator: '-', lower: true, maxChars: 24.
@Deprecated public static String generatePathSegment(String s)
PathSegmentService
insteadBasically all characters are kept, except for slashes and initial/trailing spaces.
public static boolean isValidUUID(String uuid)
Copyright © 2015 Nuxeo SA. All rights reserved.