Package org.nuxeo.common.utils
Class IdUtils
java.lang.Object
org.nuxeo.common.utils.IdUtils
Utils for identifier generation.
- Author:
- Anahide Tchertchian
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic StringgenerateId(String s, String wordSeparator, boolean lower, int maxChars) Generates an id from a non-null String.static longGenerates an unique long identifier.static StringGenerates an unique string identifier.static booleanisValidUUID(String uuid) Check if a given string has the pattern for UUID type 4
-
Field Details
-
UUID_TYPE_4_REGEXP
- See Also:
-
-
Method Details
-
generateStringId
Generates an unique string identifier. -
generateLongId
public static long generateLongId()Generates an unique long identifier. -
generateId
Generates an id from a non-null String.Replaces accented characters from a string by their ascii equivalent, removes non alphanumerical characters and replaces spaces by the given wordSeparator character.
- Parameters:
s- the original StringwordSeparator- the word separator to use (usually '-')lower- if lower is true, remove upper casemaxChars- maximum longer of identifier characters- Returns:
- the identifier String
-
isValidUUID
Check if a given string has the pattern for UUID type 4- Since:
- 5.7
-