io.alauda.kubernetes.api.model.ProjectStatusFluentImpl Maven / Gradle / Ivy
package io.alauda.kubernetes.api.model;
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 javax.validation.Valid;
import io.alauda.kubernetes.api.builder.BaseFluent;
import java.util.Collection;
import java.lang.Object;
import java.util.List;
import java.lang.Boolean;
public class ProjectStatusFluentImpl> extends io.alauda.kubernetes.api.builder.BaseFluent implements ProjectStatusFluent{
private List namespaces = new ArrayList();
public ProjectStatusFluentImpl(){
}
public ProjectStatusFluentImpl(ProjectStatus instance){
this.withNamespaces(instance.getNamespaces());
}
public A addToNamespaces(int index,ProjectNamespaceStatus item){
ProjectNamespaceStatusBuilder builder = new ProjectNamespaceStatusBuilder(item);_visitables.add(index >= 0 ? index : _visitables.size(), builder);this.namespaces.add(index >= 0 ? index : namespaces.size(), builder); return (A)this;
}
public A setToNamespaces(int index,ProjectNamespaceStatus item){
ProjectNamespaceStatusBuilder builder = new ProjectNamespaceStatusBuilder(item);
if (index < 0 || index >= _visitables.size()) { _visitables.add(builder); } else { _visitables.set(index, builder);}
if (index < 0 || index >= namespaces.size()) { namespaces.add(builder); } else { namespaces.set(index, builder);}
return (A)this;
}
public A addToNamespaces(ProjectNamespaceStatus... items){
for (ProjectNamespaceStatus item : items) {ProjectNamespaceStatusBuilder builder = new ProjectNamespaceStatusBuilder(item);_visitables.add(builder);this.namespaces.add(builder);} return (A)this;
}
public A addAllToNamespaces(Collection items){
for (ProjectNamespaceStatus item : items) {ProjectNamespaceStatusBuilder builder = new ProjectNamespaceStatusBuilder(item);_visitables.add(builder);this.namespaces.add(builder);} return (A)this;
}
public A removeFromNamespaces(ProjectNamespaceStatus... items){
for (ProjectNamespaceStatus item : items) {ProjectNamespaceStatusBuilder builder = new ProjectNamespaceStatusBuilder(item);_visitables.remove(builder);this.namespaces.remove(builder);} return (A)this;
}
public A removeAllFromNamespaces(Collection items){
for (ProjectNamespaceStatus item : items) {ProjectNamespaceStatusBuilder builder = new ProjectNamespaceStatusBuilder(item);_visitables.remove(builder);this.namespaces.remove(builder);} return (A)this;
}
/**
* This method has been deprecated, please use method buildNamespaces instead.
*/
@Deprecated public List getNamespaces(){
return build(namespaces);
}
public List buildNamespaces(){
return build(namespaces);
}
public ProjectNamespaceStatus buildNamespace(int index){
return this.namespaces.get(index).build();
}
public ProjectNamespaceStatus buildFirstNamespace(){
return this.namespaces.get(0).build();
}
public ProjectNamespaceStatus buildLastNamespace(){
return this.namespaces.get(namespaces.size() - 1).build();
}
public ProjectNamespaceStatus buildMatchingNamespace(io.alauda.kubernetes.api.builder.Predicate predicate){
for (ProjectNamespaceStatusBuilder item: namespaces) { if(predicate.apply(item)){return item.build();} } return null;
}
public A withNamespaces(List namespaces){
_visitables.removeAll(this.namespaces);
this.namespaces.clear();
if (namespaces != null) {for (ProjectNamespaceStatus item : namespaces){this.addToNamespaces(item);}} return (A) this;
}
public A withNamespaces(ProjectNamespaceStatus... namespaces){
this.namespaces.clear(); if (namespaces != null) {for (ProjectNamespaceStatus item :namespaces){ this.addToNamespaces(item);}} return (A) this;
}
public Boolean hasNamespaces(){
return namespaces!= null && !namespaces.isEmpty();
}
public ProjectStatusFluent.NamespacesNested addNewNamespace(){
return new NamespacesNestedImpl();
}
public ProjectStatusFluent.NamespacesNested addNewNamespaceLike(ProjectNamespaceStatus item){
return new NamespacesNestedImpl(-1, item);
}
public ProjectStatusFluent.NamespacesNested setNewNamespaceLike(int index,ProjectNamespaceStatus item){
return new NamespacesNestedImpl(index, item);
}
public ProjectStatusFluent.NamespacesNested editNamespace(int index){
if (namespaces.size() <= index) throw new RuntimeException("Can't edit namespaces. Index exceeds size.");
return setNewNamespaceLike(index, buildNamespace(index));
}
public ProjectStatusFluent.NamespacesNested editFirstNamespace(){
if (namespaces.size() == 0) throw new RuntimeException("Can't edit first namespaces. The list is empty.");
return setNewNamespaceLike(0, buildNamespace(0));
}
public ProjectStatusFluent.NamespacesNested editLastNamespace(){
int index = namespaces.size() - 1;
if (index < 0) throw new RuntimeException("Can't edit last namespaces. The list is empty.");
return setNewNamespaceLike(index, buildNamespace(index));
}
public ProjectStatusFluent.NamespacesNested editMatchingNamespace(io.alauda.kubernetes.api.builder.Predicate predicate){
int index = -1;
for (int i=0;i extends ProjectNamespaceStatusFluentImpl> implements ProjectStatusFluent.NamespacesNested,io.alauda.kubernetes.api.builder.Nested{
private final ProjectNamespaceStatusBuilder builder;
private final int index;
NamespacesNestedImpl(int index,ProjectNamespaceStatus item){
this.index = index;
this.builder = new ProjectNamespaceStatusBuilder(this, item);
}
NamespacesNestedImpl(){
this.index = -1;
this.builder = new ProjectNamespaceStatusBuilder(this);
}
public N and(){
return (N) ProjectStatusFluentImpl.this.setToNamespaces(index, builder.build());
}
public N endNamespace(){
return and();
}
}
}