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

me.snowdrop.istio.api.model.v1.mixer.config.RuleBuilder Maven / Gradle / Ivy

package me.snowdrop.istio.api.model.v1.mixer.config;

import me.snowdrop.istio.api.builder.VisitableBuilder;
import java.lang.Object;
import java.lang.Boolean;

public class RuleBuilder extends RuleFluentImpl implements me.snowdrop.istio.api.builder.VisitableBuilder{

    RuleFluent fluent;
    Boolean validationEnabled;

    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.withActions(instance.getActions()); 
            fluent.withMatch(instance.getMatch()); 
            this.validationEnabled = validationEnabled; 
    }
    public RuleBuilder(Rule instance){
            this(instance,true);
    }
    public RuleBuilder(Rule instance,Boolean validationEnabled){
            this.fluent = this; 
            this.withActions(instance.getActions()); 
            this.withMatch(instance.getMatch()); 
            this.validationEnabled = validationEnabled; 
    }

    public Rule build(){
            Rule buildable = new Rule(fluent.getActions(),fluent.getMatch());
            me.snowdrop.istio.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