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

me.snowdrop.istio.api.policy.v1beta1.RuleSpecBuilder Maven / Gradle / Ivy

package me.snowdrop.istio.api.policy.v1beta1;

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

public class RuleSpecBuilder extends RuleSpecFluentImpl implements VisitableBuilder{

    RuleSpecFluent fluent;
    Boolean validationEnabled;
    Validator validator;

    public RuleSpecBuilder(){
            this(true);
    }
    public RuleSpecBuilder(Boolean validationEnabled){
            this(new RuleSpec(), validationEnabled);
    }
    public RuleSpecBuilder(RuleSpecFluent fluent){
            this(fluent, true);
    }
    public RuleSpecBuilder(RuleSpecFluent fluent,Boolean validationEnabled){
            this(fluent, new RuleSpec(), validationEnabled);
    }
    public RuleSpecBuilder(RuleSpecFluent fluent,RuleSpec instance){
            this(fluent, instance, true);
    }
    public RuleSpecBuilder(RuleSpecFluent fluent,RuleSpec instance,Boolean validationEnabled){
            this.fluent = fluent; 
            fluent.withActions(instance.getActions()); 
            fluent.withMatch(instance.getMatch()); 
            this.validationEnabled = validationEnabled; 
    }
    public RuleSpecBuilder(RuleSpec instance){
            this(instance,true);
    }
    public RuleSpecBuilder(RuleSpec instance,Boolean validationEnabled){
            this.fluent = this; 
            this.withActions(instance.getActions()); 
            this.withMatch(instance.getMatch()); 
            this.validationEnabled = validationEnabled; 
    }
    public RuleSpecBuilder(Validator validator){
            this(new RuleSpec(), true);
    }
    public RuleSpecBuilder(RuleSpecFluent fluent,RuleSpec instance,Validator validator){
            this.fluent = fluent; 
            fluent.withActions(instance.getActions()); 
            fluent.withMatch(instance.getMatch()); 
            this.validator = validator;
            this.validationEnabled = validator != null; 
    }
    public RuleSpecBuilder(RuleSpec instance,Validator validator){
            this.fluent = this; 
            this.withActions(instance.getActions()); 
            this.withMatch(instance.getMatch()); 
            this.validator = validator; 
            this.validationEnabled = validator != null; 
    }

    public RuleSpec build(){
            RuleSpec buildable = new RuleSpec(fluent.getActions(),fluent.getMatch());
            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;
            RuleSpecBuilder that = (RuleSpecBuilder) 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