Class AlgoliaUtils


  • public class AlgoliaUtils
    extends Object
    • Constructor Detail

      • AlgoliaUtils

        public AlgoliaUtils()
    • Method Detail

      • isEmptyWhiteSpace

        public static Boolean isEmptyWhiteSpace​(String stringToCheck)
        Checks if the given string is empty or white spaces
      • isNullOrEmptyWhiteSpace

        public static Boolean isNullOrEmptyWhiteSpace​(String stringToCheck)
        Checks if the given string is null, empty or white spaces
      • nowUTC

        public static OffsetDateTime nowUTC()
        Memory optimization for getZoneRules with the same ZoneOffset (UTC). ZoneRules is immutable and threadsafe, but getRules method consumes a lot of memory during load testing.
      • ensureObjectID

        public static <T> void ensureObjectID​(@Nonnull
                                              Class<T> clazz)
        Ensure that the objectID field or the @JsonProperty(\"objectID\")" is present in the given class
        Parameters:
        clazz - The class to scan
        Throws:
        AlgoliaRuntimeException - When the class doesn't have an objectID field or a Jackson annotation @JsonProperty(\"objectID\"")
      • getObjectID

        public static <T> String getObjectID​(@Nonnull
                                             T data,
                                             @Nonnull
                                             Class<T> clazz)
        Get the objectID of the given class at runtime
        Parameters:
        clazz - The class to scan
        Throws:
        AlgoliaRuntimeException - When the class doesn't have an objectID field or a Jackson annotation @JsonProperty(\"objectID\"")