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

annotations.me.snowdrop.istio.adapter.statsd.StatsdBuilder Maven / Gradle / Ivy

package me.snowdrop.istio.adapter.statsd;

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

public class StatsdBuilder extends StatsdFluentImpl implements VisitableBuilder{

    StatsdFluent fluent;
    Boolean validationEnabled;
    Validator validator;

    public StatsdBuilder(){
            this(true);
    }
    public StatsdBuilder(Boolean validationEnabled){
            this(new Statsd(), validationEnabled);
    }
    public StatsdBuilder(StatsdFluent fluent){
            this(fluent, true);
    }
    public StatsdBuilder(StatsdFluent fluent,Boolean validationEnabled){
            this(fluent, new Statsd(), validationEnabled);
    }
    public StatsdBuilder(StatsdFluent fluent,Statsd instance){
            this(fluent, instance, true);
    }
    public StatsdBuilder(StatsdFluent fluent,Statsd instance,Boolean validationEnabled){
            this.fluent = fluent; 
            fluent.withApiVersion(instance.getApiVersion()); 
            fluent.withKind(instance.getKind()); 
            fluent.withMetadata(instance.getMetadata()); 
            fluent.withSpec(instance.getSpec()); 
            this.validationEnabled = validationEnabled; 
    }
    public StatsdBuilder(Statsd instance){
            this(instance,true);
    }
    public StatsdBuilder(Statsd instance,Boolean validationEnabled){
            this.fluent = this; 
            this.withApiVersion(instance.getApiVersion()); 
            this.withKind(instance.getKind()); 
            this.withMetadata(instance.getMetadata()); 
            this.withSpec(instance.getSpec()); 
            this.validationEnabled = validationEnabled; 
    }
    public StatsdBuilder(Validator validator){
            this(new Statsd(), true);
    }
    public StatsdBuilder(StatsdFluent fluent,Statsd instance,Validator validator){
            this.fluent = fluent; 
            fluent.withApiVersion(instance.getApiVersion()); 
            fluent.withKind(instance.getKind()); 
            fluent.withMetadata(instance.getMetadata()); 
            fluent.withSpec(instance.getSpec()); 
            this.validator = validator;
            this.validationEnabled = validator != null; 
    }
    public StatsdBuilder(Statsd instance,Validator validator){
            this.fluent = this; 
            this.withApiVersion(instance.getApiVersion()); 
            this.withKind(instance.getKind()); 
            this.withMetadata(instance.getMetadata()); 
            this.withSpec(instance.getSpec()); 
            this.validator = validator; 
            this.validationEnabled = validator != null; 
    }

    public Statsd build(){
            Statsd buildable = new Statsd(fluent.getApiVersion(),fluent.getKind(),fluent.getMetadata(),fluent.getSpec());
            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;
            StatsdBuilder that = (StatsdBuilder) 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