Package com.redis.om.spring.util
Class ObjectUtils
java.lang.Object
com.redis.om.spring.util.ObjectUtils
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic StringasString(Object value, MappingRedisOMConverter mappingConverter) static float[]byteArrayToFloatArray(byte[] bytes) static <T> TdocumentToEntity(redis.clients.jedis.search.Document document, Class<T> classOfT, MappingRedisOMConverter mappingConverter) static ObjectdocumentToObject(redis.clients.jedis.search.Document document, Class<?> returnedObjectType, MappingRedisOMConverter mappingConverter) static byte[]doubleListToByteArray(List<Double> doubleList) static float[]doubleListToFloatArray(List<Double> doubleList) static StringfirstToLowercase(String string) static Collection<Object> flattenCollection(Collection<Object> inputCollection) static byte[]floatArrayToByteArray(float[] input) getAllProperties(Class<?> entityType) static Set<org.springframework.beans.factory.config.BeanDefinition> getBeanDefinitionsFor(org.springframework.context.ApplicationContext ac, Class... classes) getCollectionElementClass(Field field) getCollectionElementType(Field field) static StringgetCollectionTargetClassName(String fullTypeClassName) getDeclaredFieldsTransitively(Class<?> clazz) static FieldgetDeclaredFieldTransitively(Class<?> clazz, String fieldName) static StringgetDistanceAsRedisString(org.springframework.data.geo.Distance distance) static redis.clients.jedis.args.GeoUnitgetDistanceUnit(org.springframework.data.geo.Distance distance) static List<org.springframework.data.util.Pair<EnableRedisDocumentRepositories, String>> getEnableRedisDocumentRepositories(org.springframework.context.ApplicationContext ac) static List<org.springframework.data.util.Pair<EnableRedisEnhancedRepositories, String>> getEnableRedisEnhancedRepositories(org.springframework.context.ApplicationContext ac) getFieldsWithAnnotation(Class<?> clazz, Class<? extends Annotation> annotationClass) static MethodgetGetterForField(Class<?> cls, Field field) static ObjectgetIdFieldForEntity(Object entity) static ObjectgetIdFieldForEntity(Field idField, Object entity) getIdFieldForEntityClass(Class<?> cl) static Stringstatic ObjectgetPropertyValue(Object object, String propertyName) static StringgetSchemaFieldName(redis.clients.jedis.search.Schema.Field field) static StringgetSchemaFieldType(redis.clients.jedis.search.Schema.Field field) static MethodgetSetterForField(Class<?> cls, Field field) static StringgetTargetClassName(String fullTypeClassName) static ObjectgetValueByPath(Object target, String path) static ObjectgetValueForField(Field field, Object entity) static booleanisCollection(Class<?> cls) static booleanisCollection(Field field) static booleanisFirstLowerCase(String string) isInnerClassWithEnclosing(Element element) static booleanisPrimitiveOfType(Class<?> clazz, Class<?> wrapper) static booleanisPropertyAnnotatedWith(Class<?> cls, String property, Class<? extends Annotation> annotationClass) static StringjavaNameFromExternal(String externalName) static byte[]longArrayToByteArray(long[] input) static float[]longArrayToFloatArray(long[] input) static ObjectmapToObject(Map<String, Object> properties, Class<?> returnedObjectType, MappingRedisOMConverter mappingConverter) static StringnameFromExternal(String externalName) static Stringstatic StringreplaceIfJavaUsedWord(String word) static StringReturns the 'name' part of a long name.static booleanshouldIncludeProperty(org.springframework.data.domain.ExampleMatcher matcher, String propertyName) static StringstaticField(String externalName) Returns a static field name representation of the specified camel-cased string.static StringtoLowercaseFirstCharacter(String input) Returns the specified text but with the first character lowercase.static StringtoUnderscoreSeparated(String javaName) Turns the specified string into an underscore-separated string.static StringReturns the specified text but with the first character uppercase.static StringReturns the string but with any leading and trailing quotation marks trimmed.static StringDoes something with the first character in the specified String.
-
Field Details
-
REPLACEMENT_CHARACTER
-
-
Method Details
-
getDistanceAsRedisString
-
getFieldsWithAnnotation
public static List<Field> getFieldsWithAnnotation(Class<?> clazz, Class<? extends Annotation> annotationClass) -
getDistanceUnit
public static redis.clients.jedis.args.GeoUnit getDistanceUnit(org.springframework.data.geo.Distance distance) -
getTargetClassName
-
getCollectionTargetClassName
-
firstToLowercase
-
getCollectionElementClass
-
getCollectionElementType
-
isCollection
-
isCollection
-
getIdFieldForEntityClass
-
getIdFieldForEntity
-
getIdFieldForEntity
-
getGetterForField
-
getSetterForField
-
getValueForField
-
ucfirst
Returns the specified text but with the first character uppercase.- Parameters:
input- The text.- Returns:
- The resulting text.
-
withFirst
Does something with the first character in the specified String.- Parameters:
input- The String.callback- The something.- Returns:
- The new String.
-
isFirstLowerCase
-
toLowercaseFirstCharacter
Returns the specified text but with the first character lowercase.- Parameters:
input- The text.- Returns:
- The resulting text.
-
unQuote
Returns the string but with any leading and trailing quotation marks trimmed.- Parameters:
s- the string to unquote- Returns:
- the string without surrounding quotation marks
-
toUnderscoreSeparated
Turns the specified string into an underscore-separated string.- Parameters:
javaName- the string to parse- Returns:
- as underscore separated
-
shortName
Returns the 'name' part of a long name. This is everything after the last dot for non-parameterized types. For parameterized types the rule applies to the part proceeding the bracket enclosed parameters e.g.long name java.util.Map<String, java.util.Date>returnsMap<String, java.util.Date>.- Parameters:
longName- The long name.- Returns:
- The name part.
-
isPropertyAnnotatedWith
public static boolean isPropertyAnnotatedWith(Class<?> cls, String property, Class<? extends Annotation> annotationClass) -
documentToObject
public static Object documentToObject(redis.clients.jedis.search.Document document, Class<?> returnedObjectType, MappingRedisOMConverter mappingConverter) -
mapToObject
-
documentToEntity
public static <T> T documentToEntity(redis.clients.jedis.search.Document document, Class<T> classOfT, MappingRedisOMConverter mappingConverter) -
asString
-
getBeanDefinitionsFor
-
getEnableRedisDocumentRepositories
public static List<org.springframework.data.util.Pair<EnableRedisDocumentRepositories,String>> getEnableRedisDocumentRepositories(org.springframework.context.ApplicationContext ac) -
getEnableRedisEnhancedRepositories
public static List<org.springframework.data.util.Pair<EnableRedisEnhancedRepositories,String>> getEnableRedisEnhancedRepositories(org.springframework.context.ApplicationContext ac) -
getDeclaredFieldsTransitively
-
getDeclaredFieldTransitively
public static Field getDeclaredFieldTransitively(Class<?> clazz, String fieldName) throws NoSuchFieldException - Throws:
NoSuchFieldException
-
floatArrayToByteArray
public static byte[] floatArrayToByteArray(float[] input) -
longArrayToByteArray
public static byte[] longArrayToByteArray(long[] input) -
longArrayToFloatArray
public static float[] longArrayToFloatArray(long[] input) -
byteArrayToFloatArray
public static float[] byteArrayToFloatArray(byte[] bytes) -
isPrimitiveOfType
-
getKey
-
getValueByPath
-
flattenCollection
-
replaceIfIllegalJavaIdentifierCharacter
-
staticField
Returns a static field name representation of the specified camel-cased string.- Parameters:
externalName- the string- Returns:
- the static field name representation
-
javaNameFromExternal
-
nameFromExternal
-
replaceIfJavaUsedWord
-
getSchemaFieldName
-
getSchemaFieldType
-
doubleListToByteArray
-
doubleListToFloatArray
-
isInnerClassWithEnclosing
-
getAllProperties
-
shouldIncludeProperty
public static boolean shouldIncludeProperty(org.springframework.data.domain.ExampleMatcher matcher, String propertyName) -
getPropertyValue
-