io.dekorate.servicebinding.model.ServiceBindingStatusFluentImpl Maven / Gradle / Ivy
package io.dekorate.servicebinding.model;
import io.fabric8.kubernetes.api.builder.VisitableBuilder;
import java.lang.SuppressWarnings;
import io.fabric8.kubernetes.api.builder.Nested;
import java.util.ArrayList;
import java.lang.String;
import java.util.function.Predicate;
import java.lang.Integer;
import java.lang.Deprecated;
import io.fabric8.kubernetes.api.builder.BaseFluent;
import java.util.Iterator;
import java.util.Collection;
import java.lang.Object;
import java.util.List;
import java.lang.Boolean;
/**
* Generated
*/
@SuppressWarnings(value = "unchecked")
public class ServiceBindingStatusFluentImpl> extends BaseFluent implements ServiceBindingStatusFluent{
public ServiceBindingStatusFluentImpl() {
}
public ServiceBindingStatusFluentImpl(ServiceBindingStatus instance) {
this.withConditions(instance.getConditions());
}
private ArrayList conditions;
public A addToConditions(Integer index,ServiceBindingCondition item) {
if (this.conditions == null) {this.conditions = new ArrayList();}
ServiceBindingConditionBuilder builder = new ServiceBindingConditionBuilder(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(Integer index,ServiceBindingCondition item) {
if (this.conditions == null) {this.conditions = new ArrayList();}
ServiceBindingConditionBuilder builder = new ServiceBindingConditionBuilder(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(io.dekorate.servicebinding.model.ServiceBindingCondition... items) {
if (this.conditions == null) {this.conditions = new ArrayList();}
for (ServiceBindingCondition item : items) {ServiceBindingConditionBuilder builder = new ServiceBindingConditionBuilder(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 (ServiceBindingCondition item : items) {ServiceBindingConditionBuilder builder = new ServiceBindingConditionBuilder(item);_visitables.get("conditions").add(builder);this.conditions.add(builder);} return (A)this;
}
public A removeFromConditions(io.dekorate.servicebinding.model.ServiceBindingCondition... items) {
for (ServiceBindingCondition item : items) {ServiceBindingConditionBuilder builder = new ServiceBindingConditionBuilder(item);_visitables.get("conditions").remove(builder);if (this.conditions != null) {this.conditions.remove(builder);}} return (A)this;
}
public A removeAllFromConditions(Collection items) {
for (ServiceBindingCondition item : items) {ServiceBindingConditionBuilder builder = new ServiceBindingConditionBuilder(item);_visitables.get("conditions").remove(builder);if (this.conditions != null) {this.conditions.remove(builder);}} return (A)this;
}
public A removeMatchingFromConditions(Predicate predicate) {
if (conditions == null) return (A) this;
final Iterator each = conditions.iterator();
final List visitables = _visitables.get("conditions");
while (each.hasNext()) {
ServiceBindingConditionBuilder builder = each.next();
if (predicate.test(builder)) {
visitables.remove(builder);
each.remove();
}
}
return (A)this;
}
/**
* This method has been deprecated, please use method buildConditions instead.
* @return The buildable object.
*/
@Deprecated
public List getConditions() {
return conditions != null ? build(conditions) : null;
}
public List buildConditions() {
return conditions != null ? build(conditions) : null;
}
public ServiceBindingCondition buildCondition(Integer index) {
return this.conditions.get(index).build();
}
public ServiceBindingCondition buildFirstCondition() {
return this.conditions.get(0).build();
}
public ServiceBindingCondition buildLastCondition() {
return this.conditions.get(conditions.size() - 1).build();
}
public ServiceBindingCondition buildMatchingCondition(Predicate predicate) {
for (ServiceBindingConditionBuilder item: conditions) { if(predicate.test(item)){ return item.build();} } return null;
}
public Boolean hasMatchingCondition(Predicate predicate) {
for (ServiceBindingConditionBuilder item: conditions) { if(predicate.test(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 (ServiceBindingCondition item : conditions){this.addToConditions(item);}} else { this.conditions = null;} return (A) this;
}
public A withConditions(io.dekorate.servicebinding.model.ServiceBindingCondition... conditions) {
if (this.conditions != null) {this.conditions.clear();}
if (conditions != null) {for (ServiceBindingCondition item :conditions){ this.addToConditions(item);}} return (A) this;
}
public Boolean hasConditions() {
return conditions != null && !conditions.isEmpty();
}
public ServiceBindingStatusFluent.ConditionsNested addNewCondition() {
return new ServiceBindingStatusFluentImpl.ConditionsNestedImpl();
}
public ServiceBindingStatusFluent.ConditionsNested addNewConditionLike(ServiceBindingCondition item) {
return new ServiceBindingStatusFluentImpl.ConditionsNestedImpl(-1, item);
}
public ServiceBindingStatusFluent.ConditionsNested setNewConditionLike(Integer index,ServiceBindingCondition item) {
return new ServiceBindingStatusFluentImpl.ConditionsNestedImpl(index, item);
}
public ServiceBindingStatusFluent.ConditionsNested editCondition(Integer index) {
if (conditions.size() <= index) throw new RuntimeException("Can't edit conditions. Index exceeds size.");
return setNewConditionLike(index, buildCondition(index));
}
public ServiceBindingStatusFluent.ConditionsNested editFirstCondition() {
if (conditions.size() == 0) throw new RuntimeException("Can't edit first conditions. The list is empty.");
return setNewConditionLike(0, buildCondition(0));
}
public ServiceBindingStatusFluent.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 ServiceBindingStatusFluent.ConditionsNested editMatchingCondition(Predicate predicate) {
int index = -1;
for (int i=0;i extends ServiceBindingConditionFluentImpl> implements ServiceBindingStatusFluent.ConditionsNested,Nested{
ConditionsNestedImpl(Integer index,ServiceBindingCondition item) {
this.index = index;
this.builder = new ServiceBindingConditionBuilder(this, item);
}
ConditionsNestedImpl() {
this.index = -1;
this.builder = new ServiceBindingConditionBuilder(this);
}
ServiceBindingConditionBuilder builder;
Integer index;
public N and() {
return (N) ServiceBindingStatusFluentImpl.this.setToConditions(index,builder.build());
}
public N endCondition() {
return and();
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy