Class IdUtils

    • Method Detail

      • generateStringId

        public static String generateStringId()
        Generates an unique string identifier.
      • generateLongId

        public static long generateLongId()
        Generates an unique long identifier.
      • generateId

        public static String generateId​(String s,
                                        String wordSeparator,
                                        boolean lower,
                                        int maxChars)
        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 String
        wordSeparator - the word separator to use (usually '-')
        lower - if lower is true, remove upper case
        maxChars - maximum longer of identifier characters
        Returns:
        the identifier String
      • isValidUUID

        public static boolean isValidUUID​(String uuid)
        Check if a given string has the pattern for UUID type 4
        Since:
        5.7