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

annotations.me.snowdrop.istio.api.model.v1.routing.DestinationWeightFluentImpl Maven / Gradle / Ivy

package me.snowdrop.istio.api.model.v1.routing;

import com.fasterxml.jackson.annotation.JsonPropertyDescription;
import com.fasterxml.jackson.annotation.JsonProperty;
import me.snowdrop.istio.api.builder.Nested;
import java.lang.String;
import java.util.LinkedHashMap;
import java.lang.Integer;
import java.lang.Deprecated;
import javax.validation.Valid;
import me.snowdrop.istio.api.builder.BaseFluent;
import java.lang.Object;
import java.lang.Boolean;
import java.util.Map;

public class DestinationWeightFluentImpl> extends me.snowdrop.istio.api.builder.BaseFluent implements DestinationWeightFluent{

    private IstioServiceBuilder destination;
    private Map labels;
    private Integer weight;

    public DestinationWeightFluentImpl(){
    }
    public DestinationWeightFluentImpl(DestinationWeight instance){
            this.withDestination(instance.getDestination()); 
            this.withLabels(instance.getLabels()); 
            this.withWeight(instance.getWeight()); 
    }

    
/**
 * This method has been deprecated, please use method buildDestination instead.
 */
@Deprecated public IstioService getDestination(){
            return this.destination!=null?this.destination.build():null;
    }

    public IstioService buildDestination(){
            return this.destination!=null?this.destination.build():null;
    }

    public A withDestination(IstioService destination){
            _visitables.remove(this.destination);
            if (destination!=null){ this.destination= new IstioServiceBuilder(destination); _visitables.add(this.destination);} return (A) this;
    }

    public Boolean hasDestination(){
            return this.destination != null;
    }

    public DestinationWeightFluent.DestinationNested withNewDestination(){
            return new DestinationNestedImpl();
    }

    public DestinationWeightFluent.DestinationNested withNewDestinationLike(IstioService item){
            return new DestinationNestedImpl(item);
    }

    public DestinationWeightFluent.DestinationNested editDestination(){
            return withNewDestinationLike(getDestination());
    }

    public DestinationWeightFluent.DestinationNested editOrNewDestination(){
            return withNewDestinationLike(getDestination() != null ? getDestination(): new IstioServiceBuilder().build());
    }

    public DestinationWeightFluent.DestinationNested editOrNewDestinationLike(IstioService item){
            return withNewDestinationLike(getDestination() != null ? getDestination(): item);
    }

    public A addToLabels(String key,String value){
            if(key != null && value != null) {this.labels.put(key, value);} return (A)this;
    }

    public A addToLabels(Map map){
            if(map != null) { this.labels.putAll(map);} return (A)this;
    }

    public A removeFromLabels(String key){
            if(key != null && this.labels != null) {this.labels.remove(key);} return (A)this;
    }

    public A removeFromLabels(Map map){
            if(map != null) { for(Object key : map.keySet()) {if (this.labels != null){this.labels.remove(key);}}} return (A)this;
    }

    public Map getLabels(){
            return this.labels;
    }

    public A withLabels(Map labels){
            if (this.labels == null) { this.labels = new LinkedHashMap();} else {this.labels.clear();}
            if (labels != null) {this.labels.putAll(labels);} return (A) this;
    }

    public Boolean hasLabels(){
            return this.labels != null;
    }

    public Integer getWeight(){
            return this.weight;
    }

    public A withWeight(Integer weight){
            this.weight=weight; return (A) this;
    }

    public Boolean hasWeight(){
            return this.weight != null;
    }

    public boolean equals(Object o){
            if (this == o) return true;
            if (o == null || getClass() != o.getClass()) return false;
            if (!super.equals(o)) return false;
            DestinationWeightFluentImpl that = (DestinationWeightFluentImpl) o;
            if (destination != null ? !destination.equals(that.destination) :that.destination != null) return false;
            if (labels != null ? !labels.equals(that.labels) :that.labels != null) return false;
            if (weight != null ? !weight.equals(that.weight) :that.weight != null) return false;
            return true;
    }


    public class DestinationNestedImpl extends IstioServiceFluentImpl> implements DestinationWeightFluent.DestinationNested,me.snowdrop.istio.api.builder.Nested{

            private final IstioServiceBuilder builder;
    
            DestinationNestedImpl(IstioService item){
                    this.builder = new IstioServiceBuilder(this, item);
            }
            DestinationNestedImpl(){
                    this.builder = new IstioServiceBuilder(this);
            }
    
    public N and(){
            return (N) DestinationWeightFluentImpl.this.withDestination(builder.build());
    }
    public N endDestination(){
            return and();
    }

}


}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy