annotations.io.alauda.kubernetes.api.model.extensions.SupplementalGroupsStrategyOptionsFluentImpl Maven / Gradle / Ivy
package io.alauda.kubernetes.api.model.extensions;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonInclude;
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.lang.Long;
import java.util.Collection;
import java.lang.Object;
import java.util.List;
import java.lang.Boolean;
public class SupplementalGroupsStrategyOptionsFluentImpl> extends io.alauda.kubernetes.api.builder.BaseFluent implements io.alauda.kubernetes.api.model.extensions.SupplementalGroupsStrategyOptionsFluent{
private List ranges = new ArrayList();
private String rule;
public SupplementalGroupsStrategyOptionsFluentImpl(){
}
public SupplementalGroupsStrategyOptionsFluentImpl(io.alauda.kubernetes.api.model.extensions.SupplementalGroupsStrategyOptions instance){
this.withRanges(instance.getRanges());
this.withRule(instance.getRule());
}
public A addToRanges(int index,io.alauda.kubernetes.api.model.extensions.IDRange item){
io.alauda.kubernetes.api.model.extensions.IDRangeBuilder builder = new io.alauda.kubernetes.api.model.extensions.IDRangeBuilder(item);_visitables.add(index >= 0 ? index : _visitables.size(), builder);this.ranges.add(index >= 0 ? index : ranges.size(), builder); return (A)this;
}
public A setToRanges(int index,io.alauda.kubernetes.api.model.extensions.IDRange item){
io.alauda.kubernetes.api.model.extensions.IDRangeBuilder builder = new io.alauda.kubernetes.api.model.extensions.IDRangeBuilder(item);
if (index < 0 || index >= _visitables.size()) { _visitables.add(builder); } else { _visitables.set(index, builder);}
if (index < 0 || index >= ranges.size()) { ranges.add(builder); } else { ranges.set(index, builder);}
return (A)this;
}
public A addToRanges(io.alauda.kubernetes.api.model.extensions.IDRange... items){
for (io.alauda.kubernetes.api.model.extensions.IDRange item : items) {io.alauda.kubernetes.api.model.extensions.IDRangeBuilder builder = new io.alauda.kubernetes.api.model.extensions.IDRangeBuilder(item);_visitables.add(builder);this.ranges.add(builder);} return (A)this;
}
public A addAllToRanges(Collection items){
for (io.alauda.kubernetes.api.model.extensions.IDRange item : items) {io.alauda.kubernetes.api.model.extensions.IDRangeBuilder builder = new io.alauda.kubernetes.api.model.extensions.IDRangeBuilder(item);_visitables.add(builder);this.ranges.add(builder);} return (A)this;
}
public A removeFromRanges(io.alauda.kubernetes.api.model.extensions.IDRange... items){
for (io.alauda.kubernetes.api.model.extensions.IDRange item : items) {io.alauda.kubernetes.api.model.extensions.IDRangeBuilder builder = new io.alauda.kubernetes.api.model.extensions.IDRangeBuilder(item);_visitables.remove(builder);this.ranges.remove(builder);} return (A)this;
}
public A removeAllFromRanges(Collection items){
for (io.alauda.kubernetes.api.model.extensions.IDRange item : items) {io.alauda.kubernetes.api.model.extensions.IDRangeBuilder builder = new io.alauda.kubernetes.api.model.extensions.IDRangeBuilder(item);_visitables.remove(builder);this.ranges.remove(builder);} return (A)this;
}
/**
* This method has been deprecated, please use method buildRanges instead.
*/
@Deprecated public List getRanges(){
return build(ranges);
}
public List buildRanges(){
return build(ranges);
}
public io.alauda.kubernetes.api.model.extensions.IDRange buildRange(int index){
return this.ranges.get(index).build();
}
public io.alauda.kubernetes.api.model.extensions.IDRange buildFirstRange(){
return this.ranges.get(0).build();
}
public io.alauda.kubernetes.api.model.extensions.IDRange buildLastRange(){
return this.ranges.get(ranges.size() - 1).build();
}
public io.alauda.kubernetes.api.model.extensions.IDRange buildMatchingRange(io.alauda.kubernetes.api.builder.Predicate predicate){
for (io.alauda.kubernetes.api.model.extensions.IDRangeBuilder item: ranges) { if(predicate.apply(item)){return item.build();} } return null;
}
public A withRanges(List ranges){
_visitables.removeAll(this.ranges);
this.ranges.clear();
if (ranges != null) {for (io.alauda.kubernetes.api.model.extensions.IDRange item : ranges){this.addToRanges(item);}} return (A) this;
}
public A withRanges(io.alauda.kubernetes.api.model.extensions.IDRange... ranges){
this.ranges.clear(); if (ranges != null) {for (io.alauda.kubernetes.api.model.extensions.IDRange item :ranges){ this.addToRanges(item);}} return (A) this;
}
public Boolean hasRanges(){
return ranges!= null && !ranges.isEmpty();
}
public SupplementalGroupsStrategyOptionsFluent.RangesNested addNewRange(){
return new RangesNestedImpl();
}
public SupplementalGroupsStrategyOptionsFluent.RangesNested addNewRangeLike(io.alauda.kubernetes.api.model.extensions.IDRange item){
return new RangesNestedImpl(-1, item);
}
public SupplementalGroupsStrategyOptionsFluent.RangesNested setNewRangeLike(int index,io.alauda.kubernetes.api.model.extensions.IDRange item){
return new RangesNestedImpl(index, item);
}
public SupplementalGroupsStrategyOptionsFluent.RangesNested editRange(int index){
if (ranges.size() <= index) throw new RuntimeException("Can't edit ranges. Index exceeds size.");
return setNewRangeLike(index, buildRange(index));
}
public SupplementalGroupsStrategyOptionsFluent.RangesNested editFirstRange(){
if (ranges.size() == 0) throw new RuntimeException("Can't edit first ranges. The list is empty.");
return setNewRangeLike(0, buildRange(0));
}
public SupplementalGroupsStrategyOptionsFluent.RangesNested editLastRange(){
int index = ranges.size() - 1;
if (index < 0) throw new RuntimeException("Can't edit last ranges. The list is empty.");
return setNewRangeLike(index, buildRange(index));
}
public SupplementalGroupsStrategyOptionsFluent.RangesNested editMatchingRange(io.alauda.kubernetes.api.builder.Predicate predicate){
int index = -1;
for (int i=0;i extends io.alauda.kubernetes.api.model.extensions.IDRangeFluentImpl> implements SupplementalGroupsStrategyOptionsFluent.RangesNested,io.alauda.kubernetes.api.builder.Nested{
private final io.alauda.kubernetes.api.model.extensions.IDRangeBuilder builder;
private final int index;
RangesNestedImpl(int index,io.alauda.kubernetes.api.model.extensions.IDRange item){
this.index = index;
this.builder = new io.alauda.kubernetes.api.model.extensions.IDRangeBuilder(this, item);
}
RangesNestedImpl(){
this.index = -1;
this.builder = new io.alauda.kubernetes.api.model.extensions.IDRangeBuilder(this);
}
public N and(){
return (N) SupplementalGroupsStrategyOptionsFluentImpl.this.setToRanges(index, builder.build());
}
public N endRange(){
return and();
}
}
}