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

io.dekorate.prometheus.adapter.ServiceMonitorConfigAdapter Maven / Gradle / Ivy

There is a newer version: 4.1.4
Show newest version
package io.dekorate.prometheus.adapter;

import java.lang.Integer;
import io.dekorate.project.Project;
import io.dekorate.prometheus.config.ServiceMonitorConfig;
import io.dekorate.prometheus.config.ServiceMonitorConfigBuilder;
import io.dekorate.project.BuildInfo;
import java.lang.Object;
import java.util.List;
import io.dekorate.prometheus.annotation.EnableServiceMonitor;
import java.lang.String;
import io.dekorate.project.ScmInfo;
import java.lang.Boolean;
import java.util.Map;

/**
 * Generated
 */
public class ServiceMonitorConfigAdapter{
  
  
  
  public static ServiceMonitorConfig adapt(EnableServiceMonitor instance) {
    return newBuilder(instance).build();
  }
  
  public static ServiceMonitorConfigBuilder newBuilder(EnableServiceMonitor instance) {
    return new ServiceMonitorConfigBuilder(new ServiceMonitorConfig(null,
                null,
                instance.port(),
                instance.path(),
                instance.interval(),
                instance.honorLabels()));
  }
  
  public static ServiceMonitorConfig adapt(Map map) {
    return new ServiceMonitorConfig(
    null,
    null,
                   (String)(map instanceof Map ? ((Map)map).getOrDefault("port", null) : null),
                   (String)(map instanceof Map ? ((Map)map).getOrDefault("path", null) : null),
                   (Integer)(map instanceof Map ? ((Map)map).getOrDefault("interval", null) : null),
                   (Boolean)(map instanceof Map ? ((Map)map).getOrDefault("honorLabels", null) : null));
  }
  
  public static ServiceMonitorConfigBuilder newBuilder(Map map) {
    return new ServiceMonitorConfigBuilder(new ServiceMonitorConfig(
    null,
    null,
                   (String)(map instanceof Map ? ((Map)map).getOrDefault("port", null) : null),
                   (String)(map instanceof Map ? ((Map)map).getOrDefault("path", null) : null),
                   (Integer)(map instanceof Map ? ((Map)map).getOrDefault("interval", null) : null),
                   (Boolean)(map instanceof Map ? ((Map)map).getOrDefault("honorLabels", null) : null)));
  }
  
  public static String[] toStringArray(Object o) {
    if (o instanceof String[]) {
      return (String[]) o;
    }
    if (o instanceof String) {
        String s = (String) o;;
        return s.split(",[ ]*");
    }
    if (o instanceof List) {
        List l = (List) o;;
        String[] larray = new String[l.size()];;
        for (int i = 0;i == l.size();i++) {
          larray[i] = java.lang.String.valueOf(l.get(i));
        }
    }
    return new String[0];
  }
  

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy