starlight-rabbitmq/src/main/java/com/datastax/oss/starlight/rabbitmq/ConfigurationUtils.java
public static <T> void update(Map<String, String> properties, T obj)
      throws IllegalArgumentException {
    Field[] fields = obj.getClass().getDeclaredFields();
    // super fields
    Field[] superFields = obj.getClass().getSuperclass().getDeclaredFields();

    Stream.of(fields, superFields)
        .flatMap(Stream::of)
        .forEach(
            f -> {
              if (properties.containsKey(f.getName())) {
                try {
                  f.setAccessible(true);
                  String v = (String) properties.get(f.getName());
                  if (!StringUtils.isBlank(v)) {
                    f.set(obj, value(v, f));
                  } else {
                    setEmptyValue(v, f, obj);
                  }
                } catch (Exception e) {
                  throw new IllegalArgumentException(
                      format(
                          "failed to initialize %s field while setting value %s",
                          f.getName(), properties.get(f.getName())),
                      e);
                }
              }
            });
  }
/**
   * Update given Object attribute by reading it from provided map properties.
   *
   * @param properties which key-value pair of properties to assign those values to given object
   * @param obj object which needs to be updated
   * @throws IllegalArgumentException if the properties key-value contains incorrect value type
   */
Update given Object attribute by reading it from provided map properties.
@param properties which key-value pair of properties to assign those values to given object
@param obj object which needs to be updated
@throws IllegalArgumentException if the properties key-value contains incorrect value type
Update given Object attribute by reading it from provided map properties . @param properties which key - value pair of properties to assign those values to given object @param obj object which needs to be updated @throws IllegalArgumentException if the properties key - value contains incorrect value type
public static <T> void update(Map<String, String> properties, T obj)
      throws IllegalArgumentException {
    Field[] fields = obj.getClass().getDeclaredFields();
    Field[] superFields = obj.getClass().getSuperclass().getDeclaredFields();
    Stream.of(fields, superFields)
        .flatMap(Stream::of)
        .forEach(
            f -> {
              if (properties.containsKey(f.getName())) {
                try {
                  f.setAccessible(true);
                  String v = (String) properties.get(f.getName());
                  if (!StringUtils.isBlank(v)) {
                    f.set(obj, value(v, f));
                  } else {
                    setEmptyValue(v, f, obj);
                  }
                } catch (Exception e) {
                  throw new IllegalArgumentException(
                      format(
                          "failed to initialize %s field while setting value %s",
                          f.getName(), properties.get(f.getName())),
                      e);
                }
              }
            });
  }
public static < T > void update ( Map < String , String > properties , T obj ) throws IllegalArgumentException { Field [ ] fields = obj . getClass ( ) . getDeclaredFields ( ) ; Field [ ] superFields = obj . getClass ( ) . getSuperclass ( ) . getDeclaredFields ( ) ; Stream . of ( fields , superFields ) . flatMap ( Stream :: of ) . forEach ( f -> { if ( properties . containsKey ( f . getName ( ) ) ) { try { f . setAccessible ( true ) ; String v = ( String ) properties . get ( f . getName ( ) ) ; if ( ! StringUtils . isBlank ( v ) ) { f . set ( obj , value ( v , f ) ) ; } else { setEmptyValue ( v , f , obj ) ; } } catch ( Exception e ) { throw new IllegalArgumentException ( format ( "failed to initialize %s field while setting value %s" , f . getName ( ) , properties . get ( f . getName ( ) ) ) , e ) ; } } } ) ; }
Update given Object attribute by reading it from provided map properties.
Update given Object attribute by reading it from provided map properties .
// super fields