Class Utils


  • public abstract class Utils
    extends Object
    A placeholder class for miscellaneous utility methods.
    Author:
    [email protected]
    • Constructor Detail

      • Utils

        public Utils()
    • Method Detail

      • lazySupplier

        public static <T> Supplier<T> lazySupplier​(Supplier<T> supplier)
        A lazy initialization wrapper for Supplier
        Parameters:
        supplier - Supplier to lazy-initialize
        Returns:
        lazy wrapped supplier
      • addHyphensToUuid

        public static String addHyphensToUuid​(String uuid)
        Requires an input uuid string Encoded as 32 hex characters. For example cced093a76eea418ffdc9bb9a6453df3
        Parameters:
        uuid - string encoded as 32 hex characters.
        Returns:
        uuid string encoded in 8-4-4-4-12 (rfc4122) format.
      • convertToUuidString

        @Nullable
        public static String convertToUuidString​(@Nullable
                                                 String id)
        Method converts a string Id to UUID. This Method specifically converts id's with less than 32 digit hex characters into UUID format (See RFC 4122: A Universally Unique IDentifier (UUID) URN Namespace) by left padding id with Zeroes and adding hyphens. It assumes that if the input id contains hyphens it is already an UUID. Please don't use this method to validate/guarantee your id as an UUID.
        Parameters:
        id - a string encoded in hex characters.
        Returns:
        a UUID string.