Package com.algolia.search.util
Class AlgoliaUtils
- java.lang.Object
-
- com.algolia.search.util.AlgoliaUtils
-
public class AlgoliaUtils extends Object
-
-
Constructor Summary
Constructors Constructor Description AlgoliaUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> voidensureObjectID(Class<T> clazz)Ensure that the objectID field or the @JsonProperty(\"objectID\")" is present in the given classstatic <T> StringgetObjectID(T data, Class<T> clazz)Get the objectID of the given class at runtimestatic BooleanisEmptyWhiteSpace(String stringToCheck)Checks if the given string is empty or white spacesstatic BooleanisNullOrEmptyWhiteSpace(String stringToCheck)Checks if the given string is null, empty or white spacesstatic OffsetDateTimenowUTC()Memory optimization for getZoneRules with the same ZoneOffset (UTC).
-
-
-
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\"")
-
-