code: public static Map<String, Object> getBeanProperties(Object bean) {
          Map<String, Object> props = new HashMap<>();
  
          if (bean == null) {
              return props;
          }
  
          Class<?> clazz = bean.getClass();
          try {
              //Public fields:
              Field[] fields = clazz.getFields();
              for (Field field : fields) {
                  String name = field.getName();
                  if (!name.equals("class")) {
                      props.put(field.getName(), field.get(bean));
                  }
              }
  
              //Getters:
              BeanInfo info = Introspector.getBeanInfo(clazz);
              for (PropertyDescriptor desc : info.getPropertyDescriptors()) {
                  Method readMethod = desc.getReadMethod();
                  String name = desc.getName();
                  if (readMethod != null && !name.equals("class")) {
                      props.put(desc.getName(), readMethod.invoke(bean));
                  }
              }
  
              return props;
          } catch (IntrospectionException | IllegalAccessException | IllegalArgumentException | InvocationTargetException ex) {
              throw new UniformException("Error while getting bean object properties of class" + clazz.getName(), ex);
          }
      }
docs: Returns an index of all the accessible properties of a Java bean object.
  
  @param bean Input object
  @return Index of properties, never null