
io.kubernetes.client.models.V1APIGroupListFluentImpl Maven / Gradle / Ivy
package io.kubernetes.client.models;
import com.google.gson.annotations.SerializedName;
import io.kubernetes.client.fluent.Nested;
import java.util.ArrayList;
import java.lang.String;
import io.kubernetes.client.fluent.Predicate;
import java.lang.Deprecated;
import io.kubernetes.client.fluent.BaseFluent;
import java.util.Collection;
import java.lang.Object;
import java.util.List;
import java.lang.Boolean;
public class V1APIGroupListFluentImpl> extends io.kubernetes.client.fluent.BaseFluent implements V1APIGroupListFluent{
private String apiVersion;
private List groups;
private String kind;
public V1APIGroupListFluentImpl(){
}
public V1APIGroupListFluentImpl(V1APIGroupList instance){
this.withApiVersion(instance.getApiVersion());
this.withGroups(instance.getGroups());
this.withKind(instance.getKind());
}
public String getApiVersion(){
return this.apiVersion;
}
public A withApiVersion(String apiVersion){
this.apiVersion=apiVersion; return (A) this;
}
public Boolean hasApiVersion(){
return this.apiVersion != null;
}
public A addToGroups(int index,V1APIGroup item){
if (this.groups == null) {this.groups = new ArrayList();}
V1APIGroupBuilder builder = new V1APIGroupBuilder(item);_visitables.add(index >= 0 ? index : _visitables.size(), builder);this.groups.add(index >= 0 ? index : groups.size(), builder); return (A)this;
}
public A setToGroups(int index,V1APIGroup item){
if (this.groups == null) {this.groups = new ArrayList();}
V1APIGroupBuilder builder = new V1APIGroupBuilder(item);
if (index < 0 || index >= _visitables.size()) { _visitables.add(builder); } else { _visitables.set(index, builder);}
if (index < 0 || index >= groups.size()) { groups.add(builder); } else { groups.set(index, builder);}
return (A)this;
}
public A addToGroups(V1APIGroup... items){
if (this.groups == null) {this.groups = new ArrayList();}
for (V1APIGroup item : items) {V1APIGroupBuilder builder = new V1APIGroupBuilder(item);_visitables.add(builder);this.groups.add(builder);} return (A)this;
}
public A addAllToGroups(Collection items){
if (this.groups == null) {this.groups = new ArrayList();}
for (V1APIGroup item : items) {V1APIGroupBuilder builder = new V1APIGroupBuilder(item);_visitables.add(builder);this.groups.add(builder);} return (A)this;
}
public A removeFromGroups(V1APIGroup... items){
for (V1APIGroup item : items) {V1APIGroupBuilder builder = new V1APIGroupBuilder(item);_visitables.remove(builder);if (this.groups != null) {this.groups.remove(builder);}} return (A)this;
}
public A removeAllFromGroups(Collection items){
for (V1APIGroup item : items) {V1APIGroupBuilder builder = new V1APIGroupBuilder(item);_visitables.remove(builder);if (this.groups != null) {this.groups.remove(builder);}} return (A)this;
}
/**
* This method has been deprecated, please use method buildGroups instead.
*/
@Deprecated public List getGroups(){
return build(groups);
}
public List buildGroups(){
return build(groups);
}
public V1APIGroup buildGroup(int index){
return this.groups.get(index).build();
}
public V1APIGroup buildFirstGroup(){
return this.groups.get(0).build();
}
public V1APIGroup buildLastGroup(){
return this.groups.get(groups.size() - 1).build();
}
public V1APIGroup buildMatchingGroup(io.kubernetes.client.fluent.Predicate predicate){
for (V1APIGroupBuilder item: groups) { if(predicate.apply(item)){return item.build();} } return null;
}
public A withGroups(List groups){
if (this.groups != null) { _visitables.removeAll(this.groups);}
if (groups != null) {this.groups = new ArrayList(); for (V1APIGroup item : groups){this.addToGroups(item);}} else { this.groups = null;} return (A) this;
}
public A withGroups(V1APIGroup... groups){
this.groups.clear(); if (groups != null) {for (V1APIGroup item :groups){ this.addToGroups(item);}} return (A) this;
}
public Boolean hasGroups(){
return groups != null && !groups.isEmpty();
}
public V1APIGroupListFluent.GroupsNested addNewGroup(){
return new GroupsNestedImpl();
}
public V1APIGroupListFluent.GroupsNested addNewGroupLike(V1APIGroup item){
return new GroupsNestedImpl(-1, item);
}
public V1APIGroupListFluent.GroupsNested setNewGroupLike(int index,V1APIGroup item){
return new GroupsNestedImpl(index, item);
}
public V1APIGroupListFluent.GroupsNested editGroup(int index){
if (groups.size() <= index) throw new RuntimeException("Can't edit groups. Index exceeds size.");
return setNewGroupLike(index, buildGroup(index));
}
public V1APIGroupListFluent.GroupsNested editFirstGroup(){
if (groups.size() == 0) throw new RuntimeException("Can't edit first groups. The list is empty.");
return setNewGroupLike(0, buildGroup(0));
}
public V1APIGroupListFluent.GroupsNested editLastGroup(){
int index = groups.size() - 1;
if (index < 0) throw new RuntimeException("Can't edit last groups. The list is empty.");
return setNewGroupLike(index, buildGroup(index));
}
public V1APIGroupListFluent.GroupsNested editMatchingGroup(io.kubernetes.client.fluent.Predicate predicate){
int index = -1;
for (int i=0;i extends V1APIGroupFluentImpl> implements V1APIGroupListFluent.GroupsNested,io.kubernetes.client.fluent.Nested{
private final V1APIGroupBuilder builder;
private final int index;
GroupsNestedImpl(int index,V1APIGroup item){
this.index = index;
this.builder = new V1APIGroupBuilder(this, item);
}
GroupsNestedImpl(){
this.index = -1;
this.builder = new V1APIGroupBuilder(this);
}
public N and(){
return (N) V1APIGroupListFluentImpl.this.setToGroups(index, builder.build());
}
public N endGroup(){
return and();
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy