Class BeanUtil


  • public final class BeanUtil
    extends Object
    Méthodes utilitaires pour manipuler les propriétés (getter/setter) des JavaBeans (ie tous les types d'objets).
    • Method Detail

      • getValue

        public static Object getValue​(Object object,
                                      String propertyName)
        Retourne la valeur d'une propriété d'un bean (ex : "name" -> object.getName() ou "country.name" -> object.getCountry().getName()).
        Parameters:
        object - java.lang.Object
        propertyName - java.lang.String
        Returns:
        java.lang.Object
      • setValue

        public static void setValue​(Object object,
                                    String propertyName,
                                    Object value)
        Définit la valeur d'une propriété d'un bean (ex : "name" -> object.setName(value) ou "country.name" -> object.getCountry().setName(value)).
        Parameters:
        object - java.lang.Object
        propertyName - java.lang.String
        value - java.lang.Object
      • getPropertyDescriptor

        public static PropertyDescriptor getPropertyDescriptor​(String propertyName,
                                                               Class<?> beanClass)
        Retourne le PropertyDescriptor d'une propriété.
        Parameters:
        propertyName - java.lang.String
        beanClass - java.lang.Class
        Returns:
        java.beans.PropertyDescriptor