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

me.snowdrop.istio.api.policy.v1beta1.RuleBuilder 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 RuleBuilder extends RuleFluentImpl implements VisitableBuilder{

    RuleFluent fluent;
    Boolean validationEnabled;
    Validator validator;

    public RuleBuilder(){
            this(true);
    }
    public RuleBuilder(Boolean validationEnabled){
            this(new Rule(), validationEnabled);
    }
    public RuleBuilder(RuleFluent fluent){
            this(fluent, true);
    }
    public RuleBuilder(RuleFluent fluent,Boolean validationEnabled){
            this(fluent, new Rule(), validationEnabled);
    }
    public RuleBuilder(RuleFluent fluent,Rule instance){
            this(fluent, instance, true);
    }
    public RuleBuilder(RuleFluent fluent,Rule 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 RuleBuilder(Rule instance){
            this(instance,true);
    }
    public RuleBuilder(Rule 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 RuleBuilder(Validator validator){
            this(new Rule(), true);
    }
    public RuleBuilder(RuleFluent fluent,Rule 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 RuleBuilder(Rule 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 Rule build(){
            Rule buildable = new Rule(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;
            RuleBuilder that = (RuleBuilder) 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