Package org.hisp.dhis.util
Class UidUtils
java.lang.Object
org.hisp.dhis.util.UidUtils
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringgenerateCode(int length) Generates a pseudo random string with alphanumeric characters.static StringGenerates a UID according to the following rules.static booleanisValidUid(String code) Tests whether the given code is a valid UID.
-
Constructor Details
-
UidUtils
public UidUtils()
-
-
Method Details
-
generateUid
Generates a UID according to the following rules.- Alphanumeric characters only.
- Exactly 11 characters long.
- First character is alphabetic.
- Returns:
- a UID string.
-
isValidUid
Tests whether the given code is a valid UID.- Parameters:
code- the code to validate.- Returns:
- true if the code is valid.
-
generateCode
Generates a pseudo random string with alphanumeric characters.- Parameters:
length- the number of characters in the code.- Returns:
- the code.
-