All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.vertx.ext.unit.report.ReportingOptionsConverter Maven / Gradle / Ivy

There is a newer version: 5.0.0.CR3
Show newest version
package io.vertx.ext.unit.report;

import io.vertx.core.json.JsonObject;
import io.vertx.core.json.JsonArray;
import java.time.Instant;
import java.time.format.DateTimeFormatter;

/**
 * Converter for {@link io.vertx.ext.unit.report.ReportingOptions}.
 * NOTE: This class has been automatically generated from the {@link io.vertx.ext.unit.report.ReportingOptions} original class using Vert.x codegen.
 */
public class ReportingOptionsConverter {

  public static void fromJson(Iterable> json, ReportingOptions obj) {
    for (java.util.Map.Entry member : json) {
      switch (member.getKey()) {
        case "reporters":
          if (member.getValue() instanceof JsonArray) {
            java.util.ArrayList list =  new java.util.ArrayList<>();
            ((Iterable)member.getValue()).forEach( item -> {
              if (item instanceof JsonObject)
                list.add(new io.vertx.ext.unit.report.ReportOptions((JsonObject)item));
            });
            obj.setReporters(list);
          }
          break;
      }
    }
  }

  public static void toJson(ReportingOptions obj, JsonObject json) {
    toJson(obj, json.getMap());
  }

  public static void toJson(ReportingOptions obj, java.util.Map json) {
    if (obj.getReporters() != null) {
      JsonArray array = new JsonArray();
      obj.getReporters().forEach(item -> array.add(item.toJson()));
      json.put("reporters", array);
    }
  }
}