Class ObjectUtils

java.lang.Object
com.redis.om.spring.util.ObjectUtils

public class ObjectUtils extends Object
  • Method Details

    • getDistanceAsRedisString

      public static String getDistanceAsRedisString(org.springframework.data.geo.Distance distance)
    • 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

      public static String getTargetClassName(String fullTypeClassName)
    • getCollectionTargetClassName

      public static String getCollectionTargetClassName(String fullTypeClassName)
    • firstToLowercase

      public static String firstToLowercase(String string)
    • getCollectionElementClass

      public static Optional<Class<?>> getCollectionElementClass(Field field)
    • getCollectionElementType

      public static Optional<Type> getCollectionElementType(Field field)
    • isCollection

      public static boolean isCollection(Field field)
    • isCollection

      public static boolean isCollection(Class<?> cls)
    • getIdFieldForEntityClass

      public static Optional<Field> getIdFieldForEntityClass(Class<?> cl)
    • getIdFieldForEntity

      public static Object getIdFieldForEntity(Object entity)
    • getIdFieldForEntity

      public static Object getIdFieldForEntity(Field idField, Object entity)
    • getGetterForField

      public static Method getGetterForField(Class<?> cls, Field field)
    • getSetterForField

      public static Method getSetterForField(Class<?> cls, Field field)
    • ucfirst

      public static String ucfirst(String input)
      Returns the specified text but with the first character uppercase.
      Parameters:
      input - The text.
      Returns:
      The resulting text.
    • withFirst

      public static String withFirst(String input, Function<Character,String> callback)
      Does something with the first character in the specified String.
      Parameters:
      input - The String.
      callback - The something.
      Returns:
      The new String.
    • isFirstLowerCase

      public static boolean isFirstLowerCase(String string)
    • lcfirst

      public static String lcfirst(String input)
      Returns the specified text but with the first character lowercase.
      Parameters:
      input - The text.
      Returns:
      The resulting text.
    • unQuote

      public static String unQuote(String s)
      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

      public static String toUnderscoreSeparated(String javaName)
      Turns the specified string into an underscore-separated string.
      Parameters:
      javaName - the string to parse
      Returns:
      as underscore separated
    • shortName

      public static String shortName(String longName)
      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> returns Map<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

      public static Object mapToObject(Map<String,Object> properties, Class<?> returnedObjectType, MappingRedisOMConverter mappingConverter)
    • documentToEntity

      public static <T> T documentToEntity(redis.clients.jedis.search.Document document, Class<T> classOfT, MappingRedisOMConverter mappingConverter)
    • asString

      public static String asString(Object value, MappingRedisOMConverter mappingConverter)
    • getBeanDefinitionsFor

      public static Set<org.springframework.beans.factory.config.BeanDefinition> getBeanDefinitionsFor(org.springframework.context.ApplicationContext ac, Class... classes)
    • 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

      public static List<Field> getDeclaredFieldsTransitively(Class<?> clazz)
    • 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

      public static Collection instantiateCollection(Type type)
    • isPrimitiveOfType

      public static boolean isPrimitiveOfType(Class<?> clazz, Class<?> wrapper)