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

io.fabric8.kubernetes.api.model.autoscaling.v2.ExternalMetricSourceFluentImpl Maven / Gradle / Ivy

There is a newer version: 7.0.1
Show newest version
package io.fabric8.kubernetes.api.model.autoscaling.v2;

import java.lang.SuppressWarnings;
import io.fabric8.kubernetes.api.builder.Nested;
import java.lang.String;
import java.util.LinkedHashMap;
import java.lang.Deprecated;
import io.fabric8.kubernetes.api.builder.BaseFluent;
import java.lang.Object;
import java.lang.Boolean;
import java.util.Map;

 /**
  * Generated
  */
  @SuppressWarnings(value = "unchecked")
  public class ExternalMetricSourceFluentImpl> extends BaseFluent implements ExternalMetricSourceFluent{
  public ExternalMetricSourceFluentImpl() {
  }
  public ExternalMetricSourceFluentImpl(ExternalMetricSource instance) {
    this.withMetric(instance.getMetric()); 
    this.withTarget(instance.getTarget()); 
    this.withAdditionalProperties(instance.getAdditionalProperties());

  }
  private MetricIdentifierBuilder metric;
  private MetricTargetBuilder target;
  private Map additionalProperties;
  
  /**
   * This method has been deprecated, please use method buildMetric instead.
   * @return The buildable object.
   */
  @Deprecated
  public MetricIdentifier getMetric() {
    return this.metric!=null ?this.metric.build():null;
  }
  public MetricIdentifier buildMetric() {
    return this.metric!=null ?this.metric.build():null;
  }
  public A withMetric(MetricIdentifier metric) {
    _visitables.get("metric").remove(this.metric);
    if (metric!=null){ this.metric= new MetricIdentifierBuilder(metric); _visitables.get("metric").add(this.metric);} else { this.metric = null; _visitables.get("metric").remove(this.metric); } return (A) this;
  }
  public Boolean hasMetric() {
    return this.metric != null;
  }
  public ExternalMetricSourceFluent.MetricNested withNewMetric() {
    return new ExternalMetricSourceFluentImpl.MetricNestedImpl();
  }
  public ExternalMetricSourceFluent.MetricNested withNewMetricLike(MetricIdentifier item) {
    return new ExternalMetricSourceFluentImpl.MetricNestedImpl(item);
  }
  public ExternalMetricSourceFluent.MetricNested editMetric() {
    return withNewMetricLike(getMetric());
  }
  public ExternalMetricSourceFluent.MetricNested editOrNewMetric() {
    return withNewMetricLike(getMetric() != null ? getMetric(): new MetricIdentifierBuilder().build());
  }
  public ExternalMetricSourceFluent.MetricNested editOrNewMetricLike(MetricIdentifier item) {
    return withNewMetricLike(getMetric() != null ? getMetric(): item);
  }
  
  /**
   * This method has been deprecated, please use method buildTarget instead.
   * @return The buildable object.
   */
  @Deprecated
  public MetricTarget getTarget() {
    return this.target!=null ?this.target.build():null;
  }
  public MetricTarget buildTarget() {
    return this.target!=null ?this.target.build():null;
  }
  public A withTarget(MetricTarget target) {
    _visitables.get("target").remove(this.target);
    if (target!=null){ this.target= new MetricTargetBuilder(target); _visitables.get("target").add(this.target);} else { this.target = null; _visitables.get("target").remove(this.target); } return (A) this;
  }
  public Boolean hasTarget() {
    return this.target != null;
  }
  public ExternalMetricSourceFluent.TargetNested withNewTarget() {
    return new ExternalMetricSourceFluentImpl.TargetNestedImpl();
  }
  public ExternalMetricSourceFluent.TargetNested withNewTargetLike(MetricTarget item) {
    return new ExternalMetricSourceFluentImpl.TargetNestedImpl(item);
  }
  public ExternalMetricSourceFluent.TargetNested editTarget() {
    return withNewTargetLike(getTarget());
  }
  public ExternalMetricSourceFluent.TargetNested editOrNewTarget() {
    return withNewTargetLike(getTarget() != null ? getTarget(): new MetricTargetBuilder().build());
  }
  public ExternalMetricSourceFluent.TargetNested editOrNewTargetLike(MetricTarget item) {
    return withNewTargetLike(getTarget() != null ? getTarget(): item);
  }
  public A addToAdditionalProperties(String key,Object value) {
    if(this.additionalProperties == null && key != null && value != null) { this.additionalProperties = new LinkedHashMap(); }
    if(key != null && value != null) {this.additionalProperties.put(key, value);} return (A)this;
  }
  public A addToAdditionalProperties(Map map) {
    if(this.additionalProperties == null && map != null) { this.additionalProperties = new LinkedHashMap(); }
    if(map != null) { this.additionalProperties.putAll(map);} return (A)this;
  }
  public A removeFromAdditionalProperties(String key) {
    if(this.additionalProperties == null) { return (A) this; }
    if(key != null && this.additionalProperties != null) {this.additionalProperties.remove(key);} return (A)this;
  }
  public A removeFromAdditionalProperties(Map map) {
    if(this.additionalProperties == null) { return (A) this; }
    if(map != null) { for(Object key : map.keySet()) {if (this.additionalProperties != null){this.additionalProperties.remove(key);}}} return (A)this;
  }
  public Map getAdditionalProperties() {
    return this.additionalProperties;
  }
  public A withAdditionalProperties(Map additionalProperties) {
    if (additionalProperties == null) { this.additionalProperties =  null;} else {this.additionalProperties = new LinkedHashMap(additionalProperties);} return (A) this;
  }
  public Boolean hasAdditionalProperties() {
    return this.additionalProperties != null;
  }
  public boolean equals(Object o) {
    if (this == o) return true;
    if (o == null || getClass() != o.getClass()) return false;
    ExternalMetricSourceFluentImpl that = (ExternalMetricSourceFluentImpl) o;
    if (metric != null ? !metric.equals(that.metric) :that.metric != null) return false;
    if (target != null ? !target.equals(that.target) :that.target != null) return false;
    if (additionalProperties != null ? !additionalProperties.equals(that.additionalProperties) :that.additionalProperties != null) return false;
    return true;
  }
  public int hashCode() {
    return java.util.Objects.hash(metric,  target,  additionalProperties,  super.hashCode());
  }
  public String toString() {
    StringBuilder sb = new StringBuilder();
    sb.append("{");
    if (metric != null) { sb.append("metric:"); sb.append(metric + ","); }
    if (target != null) { sb.append("target:"); sb.append(target + ","); }
    if (additionalProperties != null && !additionalProperties.isEmpty()) { sb.append("additionalProperties:"); sb.append(additionalProperties); }
    sb.append("}");
    return sb.toString();
  }
  class MetricNestedImpl extends MetricIdentifierFluentImpl> implements ExternalMetricSourceFluent.MetricNested,Nested{
    MetricNestedImpl(MetricIdentifier item) {
      this.builder = new MetricIdentifierBuilder(this, item);
    }
    MetricNestedImpl() {
      this.builder = new MetricIdentifierBuilder(this);
    }
    MetricIdentifierBuilder builder;
    public N and() {
      return (N) ExternalMetricSourceFluentImpl.this.withMetric(builder.build());
    }
    public N endMetric() {
      return and();
    }
    
  }
  class TargetNestedImpl extends MetricTargetFluentImpl> implements ExternalMetricSourceFluent.TargetNested,Nested{
    TargetNestedImpl(MetricTarget item) {
      this.builder = new MetricTargetBuilder(this, item);
    }
    TargetNestedImpl() {
      this.builder = new MetricTargetBuilder(this);
    }
    MetricTargetBuilder builder;
    public N and() {
      return (N) ExternalMetricSourceFluentImpl.this.withTarget(builder.build());
    }
    public N endTarget() {
      return and();
    }
    
  }
  
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy