java.lang.Object
org.springframework.data.aerospike.util.Utils

public class Utils extends Object
Utility class containing useful methods for interacting with Aerospike across the entire implementation
Author:
peter
  • Constructor Details

    • Utils

      public Utils()
  • Method Details

    • getReplicationFactor

      public static int getReplicationFactor(com.aerospike.client.IAerospikeClient client, com.aerospike.client.cluster.Node[] nodes, String namespace)
    • getRandomNode

      public static com.aerospike.client.cluster.Node getRandomNode(com.aerospike.client.cluster.Node[] nodes)
    • getObjectsCount

      public static long getObjectsCount(com.aerospike.client.IAerospikeClient client, com.aerospike.client.cluster.Node node, String namespace, String setName)
    • getExpValOrFail

      public static com.aerospike.client.exp.Exp getExpValOrFail(com.aerospike.client.Value value, String errMsg)
      Convert Value type to Exp
      Parameters:
      value - Value instance
      errMsg - Error message to use
      Returns:
      Exp instance
    • getExpType

      public static com.aerospike.client.exp.Exp.Type getExpType(com.aerospike.client.Value value)
    • isSimpleValueType

      public static boolean isSimpleValueType(Class<?> type)
      Checking that at least one of the arguments is of the following type: a primitive or primitive wrapper, an Enum, a String or other CharSequence, a Number, a Date, a Temporal, a UUID, a URI, a URL, a Locale, or a Class.
    • ctxArrToString

      public static String ctxArrToString(com.aerospike.client.cdt.CTX[] ctxArr)
    • logQualifierDetails

      public static void logQualifierDetails(CriteriaDefinition criteria, org.slf4j.Logger logger)
    • valueToString

      public static String valueToString(com.aerospike.client.Value value)
    • iterableToList

      public static <T> List<T> iterableToList(Iterable<T> iterable)
    • getInDifferentFormats

      public static List<String> getInDifferentFormats(String input)
      Given a String in camel case generate its variants in different formats: kebab case, snake case, Pascal case and upper case
      Parameters:
      input - String in a camel case
      Returns:
      List with 5 variants of the given String, or an empty List if input is null or empty
    • getProperty

      public static String getProperty(Environment environment, String prefix, String propertyName)
      Get value of a property by providing its prefix and name in the environment
      Parameters:
      environment - - Actual environment
      prefix - Property prefix
      propertyName - Property name in camel case, will be also checked in kebab case, snake case and underscore-separated upper case
      Returns:
      The value of the property or null
    • setStringFromConfig

      public static void setStringFromConfig(Consumer<String> setter, Environment environment, String prefix, String propertyName)
      Set String value of the given property if it is found in external configuration
      Parameters:
      setter - Setter method reference
      environment - Actual environment
      prefix - Property prefix
      propertyName - Property name in camel case
    • setBoolFromConfig

      public static void setBoolFromConfig(Consumer<Boolean> setter, Environment environment, String prefix, String propertyName)
      Set boolean value of the given property if it is found in external configuration
      Parameters:
      setter - Setter method reference
      environment - Actual environment
      prefix - Property prefix
      propertyName - Property name in camel case
    • setIntFromConfig

      public static void setIntFromConfig(Consumer<Integer> setter, Environment environment, String prefix, String propertyName)
      Set integer value of the given property if it is found in external configuration
      Parameters:
      setter - Setter method reference
      environment - Actual environment
      prefix - Property prefix
      propertyName - Property name in camel case