Class Utils
java.lang.Object
org.springframework.data.aerospike.util.Utils
Utility class containing useful methods for interacting with Aerospike across the entire implementation
- Author:
- peter
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringctxArrToString(com.aerospike.client.cdt.CTX[] ctxArr) static com.aerospike.client.exp.Exp.TypegetExpType(com.aerospike.client.Value value) static com.aerospike.client.exp.ExpgetExpValOrFail(com.aerospike.client.Value value, String errMsg) ConvertValuetype toExpgetInDifferentFormats(String input) Given a String in camel case generate its variants in different formats: kebab case, snake case, Pascal case and upper casestatic longgetObjectsCount(com.aerospike.client.IAerospikeClient client, com.aerospike.client.cluster.Node node, String namespace, String setName) static StringgetProperty(Environment environment, String prefix, String propertyName) Get value of a property by providing its prefix and name in the environmentstatic com.aerospike.client.cluster.NodegetRandomNode(com.aerospike.client.cluster.Node[] nodes) static intgetReplicationFactor(com.aerospike.client.IAerospikeClient client, com.aerospike.client.cluster.Node[] nodes, String namespace) static booleanisSimpleValueType(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.static <T> List<T>iterableToList(Iterable<T> iterable) static voidlogQualifierDetails(CriteriaDefinition criteria, org.slf4j.Logger logger) static voidsetBoolFromConfig(Consumer<Boolean> setter, Environment environment, String prefix, String propertyName) Set boolean value of the given property if it is found in external configurationstatic voidsetIntFromConfig(Consumer<Integer> setter, Environment environment, String prefix, String propertyName) Set integer value of the given property if it is found in external configurationstatic voidsetStringFromConfig(Consumer<String> setter, Environment environment, String prefix, String propertyName) Set String value of the given property if it is found in external configurationstatic StringvalueToString(com.aerospike.client.Value value)
-
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
-
getExpValOrFail
public static com.aerospike.client.exp.Exp getExpValOrFail(com.aerospike.client.Value value, String errMsg) ConvertValuetype toExp- Parameters:
value- Value instanceerrMsg- Error message to use- Returns:
- Exp instance
-
getExpType
public static com.aerospike.client.exp.Exp.Type getExpType(com.aerospike.client.Value value) -
isSimpleValueType
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
-
logQualifierDetails
-
valueToString
-
iterableToList
-
getInDifferentFormats
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
Get value of a property by providing its prefix and name in the environment- Parameters:
environment- - Actual environmentprefix- Property prefixpropertyName- 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 referenceenvironment- Actual environmentprefix- Property prefixpropertyName- 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 referenceenvironment- Actual environmentprefix- Property prefixpropertyName- 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 referenceenvironment- Actual environmentprefix- Property prefixpropertyName- Property name in camel case
-