Package com.redis.om.spring.util
Class ObjectUtils
java.lang.Object
com.redis.om.spring.util.ObjectUtils
-
Method Summary
Modifier and TypeMethodDescriptionstatic StringasString(Object value, MappingRedisOMConverter mappingConverter) 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 StringfirstToLowercase(String string) static byte[]floatArrayToByteArray(float[] input) 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 MethodgetSetterForField(Class<?> cls, Field field) static StringgetTargetClassName(String fullTypeClassName) static CollectioninstantiateCollection(Type type) static booleanisCollection(Class<?> cls) static booleanisCollection(Field field) static booleanisFirstLowerCase(String string) static booleanisPrimitiveOfType(Class<?> clazz, Class<?> wrapper) static booleanisPropertyAnnotatedWith(Class<?> cls, String property, Class<? extends Annotation> annotationClass) static StringReturns the specified text but with the first character lowercase.static byte[]longArrayToByteArray(long[] input) static ObjectmapToObject(Map<String, Object> properties, Class<?> returnedObjectType, MappingRedisOMConverter mappingConverter) static StringReturns the 'name' part of a long name.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.
-
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
-
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
-
lcfirst
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) -
instantiateCollection
-
isPrimitiveOfType
-