io.alauda.kubernetes.api.model.apiextensions.CustomResourceDefinitionStatusFluentImpl Maven / Gradle / Ivy
package io.alauda.kubernetes.api.model.apiextensions;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.alauda.kubernetes.api.builder.Nested;
import java.util.ArrayList;
import java.lang.String;
import io.alauda.kubernetes.api.builder.Predicate;
import java.lang.Deprecated;
import io.alauda.kubernetes.api.builder.BaseFluent;
import java.util.List;
import java.lang.Boolean;
import javax.validation.Valid;
import java.util.Collection;
import java.lang.Object;
public class CustomResourceDefinitionStatusFluentImpl> extends io.alauda.kubernetes.api.builder.BaseFluent implements CustomResourceDefinitionStatusFluent{
private CustomResourceDefinitionNamesBuilder acceptedNames;
private List conditions = new ArrayList();
public CustomResourceDefinitionStatusFluentImpl(){
}
public CustomResourceDefinitionStatusFluentImpl(CustomResourceDefinitionStatus instance){
this.withAcceptedNames(instance.getAcceptedNames());
this.withConditions(instance.getConditions());
}
/**
* This method has been deprecated, please use method buildAcceptedNames instead.
*/
@Deprecated public CustomResourceDefinitionNames getAcceptedNames(){
return this.acceptedNames!=null?this.acceptedNames.build():null;
}
public CustomResourceDefinitionNames buildAcceptedNames(){
return this.acceptedNames!=null?this.acceptedNames.build():null;
}
public A withAcceptedNames(CustomResourceDefinitionNames acceptedNames){
_visitables.remove(this.acceptedNames);
if (acceptedNames!=null){ this.acceptedNames= new CustomResourceDefinitionNamesBuilder(acceptedNames); _visitables.add(this.acceptedNames);} return (A) this;
}
public Boolean hasAcceptedNames(){
return this.acceptedNames!=null;
}
public CustomResourceDefinitionStatusFluent.AcceptedNamesNested withNewAcceptedNames(){
return new AcceptedNamesNestedImpl();
}
public CustomResourceDefinitionStatusFluent.AcceptedNamesNested withNewAcceptedNamesLike(CustomResourceDefinitionNames item){
return new AcceptedNamesNestedImpl(item);
}
public CustomResourceDefinitionStatusFluent.AcceptedNamesNested editAcceptedNames(){
return withNewAcceptedNamesLike(getAcceptedNames());
}
public CustomResourceDefinitionStatusFluent.AcceptedNamesNested editOrNewAcceptedNames(){
return withNewAcceptedNamesLike(getAcceptedNames() != null ? getAcceptedNames(): new CustomResourceDefinitionNamesBuilder().build());
}
public CustomResourceDefinitionStatusFluent.AcceptedNamesNested editOrNewAcceptedNamesLike(CustomResourceDefinitionNames item){
return withNewAcceptedNamesLike(getAcceptedNames() != null ? getAcceptedNames(): item);
}
public A addToConditions(int index,CustomResourceDefinitionCondition item){
CustomResourceDefinitionConditionBuilder builder = new CustomResourceDefinitionConditionBuilder(item);_visitables.add(index >= 0 ? index : _visitables.size(), builder);this.conditions.add(index >= 0 ? index : conditions.size(), builder); return (A)this;
}
public A setToConditions(int index,CustomResourceDefinitionCondition item){
CustomResourceDefinitionConditionBuilder builder = new CustomResourceDefinitionConditionBuilder(item);
if (index < 0 || index >= _visitables.size()) { _visitables.add(builder); } else { _visitables.set(index, builder);}
if (index < 0 || index >= conditions.size()) { conditions.add(builder); } else { conditions.set(index, builder);}
return (A)this;
}
public A addToConditions(CustomResourceDefinitionCondition... items){
for (CustomResourceDefinitionCondition item : items) {CustomResourceDefinitionConditionBuilder builder = new CustomResourceDefinitionConditionBuilder(item);_visitables.add(builder);this.conditions.add(builder);} return (A)this;
}
public A addAllToConditions(Collection items){
for (CustomResourceDefinitionCondition item : items) {CustomResourceDefinitionConditionBuilder builder = new CustomResourceDefinitionConditionBuilder(item);_visitables.add(builder);this.conditions.add(builder);} return (A)this;
}
public A removeFromConditions(CustomResourceDefinitionCondition... items){
for (CustomResourceDefinitionCondition item : items) {CustomResourceDefinitionConditionBuilder builder = new CustomResourceDefinitionConditionBuilder(item);_visitables.remove(builder);this.conditions.remove(builder);} return (A)this;
}
public A removeAllFromConditions(Collection items){
for (CustomResourceDefinitionCondition item : items) {CustomResourceDefinitionConditionBuilder builder = new CustomResourceDefinitionConditionBuilder(item);_visitables.remove(builder);this.conditions.remove(builder);} return (A)this;
}
/**
* This method has been deprecated, please use method buildConditions instead.
*/
@Deprecated public List getConditions(){
return build(conditions);
}
public List buildConditions(){
return build(conditions);
}
public CustomResourceDefinitionCondition buildCondition(int index){
return this.conditions.get(index).build();
}
public CustomResourceDefinitionCondition buildFirstCondition(){
return this.conditions.get(0).build();
}
public CustomResourceDefinitionCondition buildLastCondition(){
return this.conditions.get(conditions.size() - 1).build();
}
public CustomResourceDefinitionCondition buildMatchingCondition(io.alauda.kubernetes.api.builder.Predicate predicate){
for (CustomResourceDefinitionConditionBuilder item: conditions) { if(predicate.apply(item)){return item.build();} } return null;
}
public A withConditions(List conditions){
_visitables.removeAll(this.conditions);
this.conditions.clear();
if (conditions != null) {for (CustomResourceDefinitionCondition item : conditions){this.addToConditions(item);}} return (A) this;
}
public A withConditions(CustomResourceDefinitionCondition... conditions){
this.conditions.clear(); if (conditions != null) {for (CustomResourceDefinitionCondition item :conditions){ this.addToConditions(item);}} return (A) this;
}
public Boolean hasConditions(){
return conditions!= null && !conditions.isEmpty();
}
public CustomResourceDefinitionStatusFluent.ConditionsNested addNewCondition(){
return new ConditionsNestedImpl();
}
public CustomResourceDefinitionStatusFluent.ConditionsNested addNewConditionLike(CustomResourceDefinitionCondition item){
return new ConditionsNestedImpl(-1, item);
}
public CustomResourceDefinitionStatusFluent.ConditionsNested setNewConditionLike(int index,CustomResourceDefinitionCondition item){
return new ConditionsNestedImpl(index, item);
}
public CustomResourceDefinitionStatusFluent.ConditionsNested editCondition(int index){
if (conditions.size() <= index) throw new RuntimeException("Can't edit conditions. Index exceeds size.");
return setNewConditionLike(index, buildCondition(index));
}
public CustomResourceDefinitionStatusFluent.ConditionsNested editFirstCondition(){
if (conditions.size() == 0) throw new RuntimeException("Can't edit first conditions. The list is empty.");
return setNewConditionLike(0, buildCondition(0));
}
public CustomResourceDefinitionStatusFluent.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 CustomResourceDefinitionStatusFluent.ConditionsNested editMatchingCondition(io.alauda.kubernetes.api.builder.Predicate predicate){
int index = -1;
for (int i=0;i extends CustomResourceDefinitionNamesFluentImpl> implements CustomResourceDefinitionStatusFluent.AcceptedNamesNested,io.alauda.kubernetes.api.builder.Nested{
private final CustomResourceDefinitionNamesBuilder builder;
AcceptedNamesNestedImpl(CustomResourceDefinitionNames item){
this.builder = new CustomResourceDefinitionNamesBuilder(this, item);
}
AcceptedNamesNestedImpl(){
this.builder = new CustomResourceDefinitionNamesBuilder(this);
}
public N and(){
return (N) CustomResourceDefinitionStatusFluentImpl.this.withAcceptedNames(builder.build());
}
public N endAcceptedNames(){
return and();
}
}
public class ConditionsNestedImpl extends CustomResourceDefinitionConditionFluentImpl> implements CustomResourceDefinitionStatusFluent.ConditionsNested,io.alauda.kubernetes.api.builder.Nested{
private final CustomResourceDefinitionConditionBuilder builder;
private final int index;
ConditionsNestedImpl(int index,CustomResourceDefinitionCondition item){
this.index = index;
this.builder = new CustomResourceDefinitionConditionBuilder(this, item);
}
ConditionsNestedImpl(){
this.index = -1;
this.builder = new CustomResourceDefinitionConditionBuilder(this);
}
public N and(){
return (N) CustomResourceDefinitionStatusFluentImpl.this.setToConditions(index, builder.build());
}
public N endCondition(){
return and();
}
}
}