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

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

package io.fabric8.kubernetes.api.model.autoscaling.v2beta2;

import com.fasterxml.jackson.annotation.JsonProperty;
import io.fabric8.kubernetes.api.builder.Nested;
import java.lang.Deprecated;
import io.fabric8.kubernetes.api.builder.BaseFluent;
import java.lang.Object;
import java.lang.Boolean;

public class ExternalMetricSourceFluentImpl> extends io.fabric8.kubernetes.api.builder.BaseFluent implements io.fabric8.kubernetes.api.model.autoscaling.v2beta2.ExternalMetricSourceFluent {

    private MetricIdentifierBuilder metric;
    private MetricTargetBuilder target;

    public ExternalMetricSourceFluentImpl() { 
    }


    public ExternalMetricSourceFluentImpl(io.fabric8.kubernetes.api.model.autoscaling.v2beta2.ExternalMetricSource instance) { 
        this.withMetric(instance.getMetric()); 
        this.withTarget(instance.getTarget()); 
    }


    
/**
 * 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);} return (A) this;
    }

    public Boolean hasMetric() {
        return this.metric != null;
    }

    public ExternalMetricSourceFluent.MetricNested withNewMetric() {
        return new MetricNestedImpl();
    }

    public ExternalMetricSourceFluent.MetricNested withNewMetricLike(MetricIdentifier item) {
        return new 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);} return (A) this;
    }

    public Boolean hasTarget() {
        return this.target != null;
    }

    public ExternalMetricSourceFluent.TargetNested withNewTarget() {
        return new TargetNestedImpl();
    }

    public ExternalMetricSourceFluent.TargetNested withNewTargetLike(MetricTarget item) {
        return new 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 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;
        return true;
    }

    public int hashCode() {
        return java.util.Objects.hash(metric,  target,  super.hashCode());
    }

    public class MetricNestedImpl extends MetricIdentifierFluentImpl> implements ExternalMetricSourceFluent.MetricNested,io.fabric8.kubernetes.api.builder.Nested {
        private final MetricIdentifierBuilder builder;

        MetricNestedImpl(MetricIdentifier item) {
            this.builder = new MetricIdentifierBuilder(this, item);
        }

        MetricNestedImpl() {
            this.builder = new MetricIdentifierBuilder(this);
        }

        public N and() {
             return (N) ExternalMetricSourceFluentImpl.this.withMetric(builder.build());
        }

        public N endMetric() {
             return and();
        }
    }


    public class TargetNestedImpl extends MetricTargetFluentImpl> implements ExternalMetricSourceFluent.TargetNested,io.fabric8.kubernetes.api.builder.Nested {
        private final MetricTargetBuilder builder;

        TargetNestedImpl(MetricTarget item) {
            this.builder = new MetricTargetBuilder(this, item);
        }

        TargetNestedImpl() {
            this.builder = new MetricTargetBuilder(this);
        }

        public N and() {
             return (N) ExternalMetricSourceFluentImpl.this.withTarget(builder.build());
        }

        public N endTarget() {
             return and();
        }
    }


}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy