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

annotations.io.fabric8.knative.eventing.v1alpha1.BrokerStatusFluentImpl Maven / Gradle / Ivy

package io.fabric8.knative.eventing.v1alpha1;

import io.fabric8.kubernetes.api.builder.VisitableBuilder;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.fabric8.kubernetes.api.builder.Nested;
import java.util.ArrayList;
import java.lang.String;
import io.fabric8.kubernetes.api.builder.Predicate;
import io.fabric8.knative.duck.v1alpha1.AddressableFluentImpl;
import io.fabric8.kubernetes.api.model.ObjectReference;
import java.lang.Deprecated;
import io.fabric8.kubernetes.api.builder.BaseFluent;
import java.util.Iterator;
import java.util.List;
import java.lang.Boolean;
import io.fabric8.knative.v1.Condition;
import io.fabric8.knative.v1.ConditionBuilder;
import io.fabric8.knative.v1.ConditionFluentImpl;
import io.fabric8.knative.duck.v1alpha1.AddressableBuilder;
import java.lang.Long;
import io.fabric8.knative.duck.v1alpha1.Addressable;
import java.util.Collection;
import java.lang.Object;

public class BrokerStatusFluentImpl> extends io.fabric8.kubernetes.api.builder.BaseFluent implements BrokerStatusFluent{

    private io.fabric8.knative.duck.v1alpha1.AddressableBuilder address;
    private List conditions;
    private Long observedGeneration;
    private ObjectReference triggerChannel;

    public BrokerStatusFluentImpl(){
    }
    public BrokerStatusFluentImpl(BrokerStatus instance){
            this.withAddress(instance.getAddress()); 
            this.withConditions(instance.getConditions()); 
            this.withObservedGeneration(instance.getObservedGeneration()); 
            this.withTriggerChannel(instance.getTriggerChannel()); 
    }

    
/**
 * This method has been deprecated, please use method buildAddress instead.
 * @return The buildable object.
 */
@java.lang.Deprecated public io.fabric8.knative.duck.v1alpha1.Addressable getAddress(){
            return this.address!=null?this.address.build():null;
    }

    public io.fabric8.knative.duck.v1alpha1.Addressable buildAddress(){
            return this.address!=null?this.address.build():null;
    }

    public A withAddress(io.fabric8.knative.duck.v1alpha1.Addressable address){
            _visitables.get("address").remove(this.address);
            if (address!=null){ this.address= new io.fabric8.knative.duck.v1alpha1.AddressableBuilder(address); _visitables.get("address").add(this.address);} return (A) this;
    }

    public Boolean hasAddress(){
            return this.address != null;
    }

    public A withNewV1alpha1Address(String hostname,String url){
            return (A)withAddress(new Addressable(hostname, url));
    }

    public BrokerStatusFluent.V1alpha1AddressNested withNewV1alpha1Address(){
            return new V1alpha1AddressNestedImpl();
    }

    public BrokerStatusFluent.V1alpha1AddressNested withNewAddressLike(io.fabric8.knative.duck.v1alpha1.Addressable item){
            return new V1alpha1AddressNestedImpl(item);
    }

    public BrokerStatusFluent.V1alpha1AddressNested editV1alpha1Address(){
            return withNewAddressLike(getAddress());
    }

    public BrokerStatusFluent.V1alpha1AddressNested editOrNewAddress(){
            return withNewAddressLike(getAddress() != null ? getAddress(): new io.fabric8.knative.duck.v1alpha1.AddressableBuilder().build());
    }

    public BrokerStatusFluent.V1alpha1AddressNested editOrNewAddressLike(io.fabric8.knative.duck.v1alpha1.Addressable item){
            return withNewAddressLike(getAddress() != null ? getAddress(): item);
    }

    public A addToConditions(int index,Condition item){
            if (this.conditions == null) {this.conditions = new ArrayList();}
            ConditionBuilder builder = new ConditionBuilder(item);_visitables.get("conditions").add(index >= 0 ? index : _visitables.get("conditions").size(), builder);this.conditions.add(index >= 0 ? index : conditions.size(), builder); return (A)this;
    }

    public A setToConditions(int index,Condition item){
            if (this.conditions == null) {this.conditions = new ArrayList();}
            ConditionBuilder builder = new ConditionBuilder(item);
            if (index < 0 || index >= _visitables.get("conditions").size()) { _visitables.get("conditions").add(builder); } else { _visitables.get("conditions").set(index, builder);}
            if (index < 0 || index >= conditions.size()) { conditions.add(builder); } else { conditions.set(index, builder);}
             return (A)this;
    }

    public A addToConditions(Condition... items){
            if (this.conditions == null) {this.conditions = new ArrayList();}
            for (Condition item : items) {ConditionBuilder builder = new ConditionBuilder(item);_visitables.get("conditions").add(builder);this.conditions.add(builder);} return (A)this;
    }

    public A addAllToConditions(Collection items){
            if (this.conditions == null) {this.conditions = new ArrayList();}
            for (Condition item : items) {ConditionBuilder builder = new ConditionBuilder(item);_visitables.get("conditions").add(builder);this.conditions.add(builder);} return (A)this;
    }

    public A removeFromConditions(Condition... items){
            for (Condition item : items) {ConditionBuilder builder = new ConditionBuilder(item);_visitables.get("conditions").remove(builder);if (this.conditions != null) {this.conditions.remove(builder);}} return (A)this;
    }

    public A removeAllFromConditions(Collection items){
            for (Condition item : items) {ConditionBuilder builder = new ConditionBuilder(item);_visitables.get("conditions").remove(builder);if (this.conditions != null) {this.conditions.remove(builder);}} return (A)this;
    }

    public A removeMatchingFromConditions(io.fabric8.kubernetes.api.builder.Predicate predicate){
            if (conditions == null) return (A) this;
            final Iterator each = conditions.iterator();
            final List visitables = _visitables.get("conditions");
            while (each.hasNext()) {
              ConditionBuilder builder = each.next();
              if (predicate.apply(builder)) {
                visitables.remove(builder);
                each.remove();
              }
            }
            return (A)this;
    }

    
/**
 * This method has been deprecated, please use method buildConditions instead.
 * @return The buildable object.
 */
@java.lang.Deprecated public List getConditions(){
            return build(conditions);
    }

    public List buildConditions(){
            return build(conditions);
    }

    public Condition buildCondition(int index){
            return this.conditions.get(index).build();
    }

    public Condition buildFirstCondition(){
            return this.conditions.get(0).build();
    }

    public Condition buildLastCondition(){
            return this.conditions.get(conditions.size() - 1).build();
    }

    public Condition buildMatchingCondition(io.fabric8.kubernetes.api.builder.Predicate predicate){
            for (ConditionBuilder item: conditions) { if(predicate.apply(item)){ return item.build();} } return null;
    }

    public Boolean hasMatchingCondition(io.fabric8.kubernetes.api.builder.Predicate predicate){
            for (ConditionBuilder item: conditions) { if(predicate.apply(item)){ return true;} } return false;
    }

    public A withConditions(List conditions){
            if (this.conditions != null) { _visitables.get("conditions").removeAll(this.conditions);}
            if (conditions != null) {this.conditions = new ArrayList(); for (Condition item : conditions){this.addToConditions(item);}} else { this.conditions = null;} return (A) this;
    }

    public A withConditions(Condition... conditions){
            if (this.conditions != null) {this.conditions.clear();}
            if (conditions != null) {for (Condition item :conditions){ this.addToConditions(item);}} return (A) this;
    }

    public Boolean hasConditions(){
            return conditions != null && !conditions.isEmpty();
    }

    public BrokerStatusFluent.ConditionsNested addNewCondition(){
            return new ConditionsNestedImpl();
    }

    public BrokerStatusFluent.ConditionsNested addNewConditionLike(Condition item){
            return new ConditionsNestedImpl(-1, item);
    }

    public BrokerStatusFluent.ConditionsNested setNewConditionLike(int index,Condition item){
            return new ConditionsNestedImpl(index, item);
    }

    public BrokerStatusFluent.ConditionsNested editCondition(int index){
            if (conditions.size() <= index) throw new RuntimeException("Can't edit conditions. Index exceeds size.");
            return setNewConditionLike(index, buildCondition(index));
    }

    public BrokerStatusFluent.ConditionsNested editFirstCondition(){
            if (conditions.size() == 0) throw new RuntimeException("Can't edit first conditions. The list is empty.");
            return setNewConditionLike(0, buildCondition(0));
    }

    public BrokerStatusFluent.ConditionsNested editLastCondition(){
            int index = conditions.size() - 1;
            if (index < 0) throw new RuntimeException("Can't edit last conditions. The list is empty.");
            return setNewConditionLike(index, buildCondition(index));
    }

    public BrokerStatusFluent.ConditionsNested editMatchingCondition(io.fabric8.kubernetes.api.builder.Predicate predicate){
            int index = -1;
            for (int i=0;i extends io.fabric8.knative.duck.v1alpha1.AddressableFluentImpl> implements BrokerStatusFluent.V1alpha1AddressNested,io.fabric8.kubernetes.api.builder.Nested{

            private final io.fabric8.knative.duck.v1alpha1.AddressableBuilder builder;
    
            V1alpha1AddressNestedImpl(io.fabric8.knative.duck.v1alpha1.Addressable item){
                    this.builder = new io.fabric8.knative.duck.v1alpha1.AddressableBuilder(this, item);
            }
            V1alpha1AddressNestedImpl(){
                    this.builder = new io.fabric8.knative.duck.v1alpha1.AddressableBuilder(this);
            }
    
    public N and(){
            return (N) BrokerStatusFluentImpl.this.withAddress(builder.build());
    }
    public N endAddress(){
            return and();
    }

}
    public class ConditionsNestedImpl extends ConditionFluentImpl> implements BrokerStatusFluent.ConditionsNested,io.fabric8.kubernetes.api.builder.Nested{

            private final ConditionBuilder builder;
        private final int index;
    
            ConditionsNestedImpl(int index,Condition item){
                    this.index = index;
                    this.builder = new ConditionBuilder(this, item);
            }
            ConditionsNestedImpl(){
                    this.index = -1;
                    this.builder = new ConditionBuilder(this);
            }
    
    public N and(){
            return (N) BrokerStatusFluentImpl.this.setToConditions(index,builder.build());
    }
    public N endCondition(){
            return and();
    }

}


}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy