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

me.snowdrop.istio.mixer.adapter.dogstatsd.DogstatsdSpecBuilder Maven / Gradle / Ivy

package me.snowdrop.istio.mixer.adapter.dogstatsd;

import io.fabric8.kubernetes.api.builder.VisitableBuilder;
import java.lang.Object;
import java.lang.Boolean;
import javax.validation.Validator;

public class DogstatsdSpecBuilder extends DogstatsdSpecFluentImpl implements VisitableBuilder{

    DogstatsdSpecFluent fluent;
    Boolean validationEnabled;
    Validator validator;

    public DogstatsdSpecBuilder(){
            this(true);
    }
    public DogstatsdSpecBuilder(Boolean validationEnabled){
            this(new DogstatsdSpec(), validationEnabled);
    }
    public DogstatsdSpecBuilder(DogstatsdSpecFluent fluent){
            this(fluent, true);
    }
    public DogstatsdSpecBuilder(DogstatsdSpecFluent fluent,Boolean validationEnabled){
            this(fluent, new DogstatsdSpec(), validationEnabled);
    }
    public DogstatsdSpecBuilder(DogstatsdSpecFluent fluent,DogstatsdSpec instance){
            this(fluent, instance, true);
    }
    public DogstatsdSpecBuilder(DogstatsdSpecFluent fluent,DogstatsdSpec instance,Boolean validationEnabled){
            this.fluent = fluent; 
            fluent.withAddress(instance.getAddress()); 
            fluent.withBufferLength(instance.getBufferLength()); 
            fluent.withGlobalTags(instance.getGlobalTags()); 
            fluent.withMetrics(instance.getMetrics()); 
            fluent.withPrefix(instance.getPrefix()); 
            fluent.withSampleRate(instance.getSampleRate()); 
            this.validationEnabled = validationEnabled; 
    }
    public DogstatsdSpecBuilder(DogstatsdSpec instance){
            this(instance,true);
    }
    public DogstatsdSpecBuilder(DogstatsdSpec instance,Boolean validationEnabled){
            this.fluent = this; 
            this.withAddress(instance.getAddress()); 
            this.withBufferLength(instance.getBufferLength()); 
            this.withGlobalTags(instance.getGlobalTags()); 
            this.withMetrics(instance.getMetrics()); 
            this.withPrefix(instance.getPrefix()); 
            this.withSampleRate(instance.getSampleRate()); 
            this.validationEnabled = validationEnabled; 
    }
    public DogstatsdSpecBuilder(Validator validator){
            this(new DogstatsdSpec(), true);
    }
    public DogstatsdSpecBuilder(DogstatsdSpecFluent fluent,DogstatsdSpec instance,Validator validator){
            this.fluent = fluent; 
            fluent.withAddress(instance.getAddress()); 
            fluent.withBufferLength(instance.getBufferLength()); 
            fluent.withGlobalTags(instance.getGlobalTags()); 
            fluent.withMetrics(instance.getMetrics()); 
            fluent.withPrefix(instance.getPrefix()); 
            fluent.withSampleRate(instance.getSampleRate()); 
            this.validator = validator;
            this.validationEnabled = validator != null; 
    }
    public DogstatsdSpecBuilder(DogstatsdSpec instance,Validator validator){
            this.fluent = this; 
            this.withAddress(instance.getAddress()); 
            this.withBufferLength(instance.getBufferLength()); 
            this.withGlobalTags(instance.getGlobalTags()); 
            this.withMetrics(instance.getMetrics()); 
            this.withPrefix(instance.getPrefix()); 
            this.withSampleRate(instance.getSampleRate()); 
            this.validator = validator; 
            this.validationEnabled = validator != null; 
    }

    public DogstatsdSpec build(){
            DogstatsdSpec buildable = new DogstatsdSpec(fluent.getAddress(),fluent.getBufferLength(),fluent.getGlobalTags(),fluent.getMetrics(),fluent.getPrefix(),fluent.getSampleRate());
            if (validationEnabled) {io.fabric8.kubernetes.api.builder.ValidationUtils.validate(buildable);}
            return buildable;
    }

    public boolean equals(Object o){
            if (this == o) return true;
            if (o == null || getClass() != o.getClass()) return false;
            if (!super.equals(o)) return false;
            DogstatsdSpecBuilder that = (DogstatsdSpecBuilder) o;
            if (fluent != null &&fluent != this ? !fluent.equals(that.fluent) :that.fluent != null &&fluent != this ) return false;

            if (validationEnabled != null ? !validationEnabled.equals(that.validationEnabled) :that.validationEnabled != null) return false;
            return true;
    }




}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy