java.lang.Object
org.springframework.content.commons.utils.BeanUtils

public final class BeanUtils extends Object
  • Method Details

    • hasFieldWithAnnotation

      public static boolean hasFieldWithAnnotation(Object domainObj, Class<? extends Annotation> annotationClass) throws SecurityException, org.springframework.beans.BeansException
      Throws:
      SecurityException
      org.springframework.beans.BeansException
    • findFieldWithAnnotation

      public static Field findFieldWithAnnotation(Object domainObj, Class<? extends Annotation> annotationClass) throws SecurityException, org.springframework.beans.BeansException
      Throws:
      SecurityException
      org.springframework.beans.BeansException
    • findFieldWithAnnotation

      public static Field findFieldWithAnnotation(Class<?> domainObjClass, Class<? extends Annotation> annotationClass) throws SecurityException, org.springframework.beans.BeansException
      Throws:
      SecurityException
      org.springframework.beans.BeansException
    • findFieldsWithAnnotation

      public static Field[] findFieldsWithAnnotation(Class<?> domainObjClass, Class<? extends Annotation> annotationClass, org.springframework.beans.BeanWrapper wrapper)
    • getAllFields

      protected static List<Field> getAllFields(Class<?> type)
    • getAllFields

      protected static List<Field> getAllFields(List<Field> fields, Class<?> type)
    • getField

      protected static Field getField(Class<?> type, String fieldName)
    • getFieldWithAnnotationType

      public static Class<?> getFieldWithAnnotationType(Object domainObj, Class<? extends Annotation> annotationClass) throws SecurityException, org.springframework.beans.BeansException
      Throws:
      SecurityException
      org.springframework.beans.BeansException
    • getFieldWithAnnotation

      public static Object getFieldWithAnnotation(Object domainObj, Class<? extends Annotation> annotationClass) throws SecurityException, org.springframework.beans.BeansException
      Throws:
      SecurityException
      org.springframework.beans.BeansException
    • getFieldsWithAnnotation

      public static Object[] getFieldsWithAnnotation(Object domainObj, Class<? extends Annotation> annotationClass)
    • setFieldWithAnnotation

      public static void setFieldWithAnnotation(Object domainObj, Class<? extends Annotation> annotationClass, Object value)
      Sets object's field annotated with annotationClass to value.
      Parameters:
      domainObj - the object containing the field
      annotationClass - the annotation to look for
      value - the value to set
    • setFieldWithAnnotationConditionally

      public static void setFieldWithAnnotationConditionally(Object domainObj, Class<? extends Annotation> annotationClass, Object value, Condition condition)
      Sets object's field annotated with annotationClass to value only if the condition matches.
      Parameters:
      domainObj - the object containing the field
      annotationClass - the annotation to look for
      value - the value to set
      condition - the condition that must be satisfied to allow the match
    • getDefaultValueForType

      public static Object getDefaultValueForType(Class<?> fieldType)