annotations.me.snowdrop.istio.api.policy.v1beta1.RuleSpecFluentImpl Maven / Gradle / Ivy
package me.snowdrop.istio.api.policy.v1beta1;
import com.fasterxml.jackson.annotation.JsonPropertyDescription;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.fabric8.kubernetes.api.builder.Nested;
import java.util.ArrayList;
import java.lang.String;
import io.fabric8.kubernetes.api.builder.Predicate;
import java.lang.Deprecated;
import javax.validation.Valid;
import io.fabric8.kubernetes.api.builder.BaseFluent;
import java.util.Collection;
import java.lang.Object;
import java.util.List;
import java.lang.Boolean;
public class RuleSpecFluentImpl> extends io.fabric8.kubernetes.api.builder.BaseFluent implements RuleSpecFluent{
private List actions;
private String match;
public RuleSpecFluentImpl(){
}
public RuleSpecFluentImpl(RuleSpec instance){
this.withActions(instance.getActions());
this.withMatch(instance.getMatch());
}
public A addToActions(int index,Action item){
if (this.actions == null) {this.actions = new ArrayList();}
ActionBuilder builder = new ActionBuilder(item);_visitables.add(index >= 0 ? index : _visitables.size(), builder);this.actions.add(index >= 0 ? index : actions.size(), builder); return (A)this;
}
public A setToActions(int index,Action item){
if (this.actions == null) {this.actions = new ArrayList();}
ActionBuilder builder = new ActionBuilder(item);
if (index < 0 || index >= _visitables.size()) { _visitables.add(builder); } else { _visitables.set(index, builder);}
if (index < 0 || index >= actions.size()) { actions.add(builder); } else { actions.set(index, builder);}
return (A)this;
}
public A addToActions(Action... items){
if (this.actions == null) {this.actions = new ArrayList();}
for (Action item : items) {ActionBuilder builder = new ActionBuilder(item);_visitables.add(builder);this.actions.add(builder);} return (A)this;
}
public A addAllToActions(Collection items){
if (this.actions == null) {this.actions = new ArrayList();}
for (Action item : items) {ActionBuilder builder = new ActionBuilder(item);_visitables.add(builder);this.actions.add(builder);} return (A)this;
}
public A removeFromActions(Action... items){
for (Action item : items) {ActionBuilder builder = new ActionBuilder(item);_visitables.remove(builder);if (this.actions != null) {this.actions.remove(builder);}} return (A)this;
}
public A removeAllFromActions(Collection items){
for (Action item : items) {ActionBuilder builder = new ActionBuilder(item);_visitables.remove(builder);if (this.actions != null) {this.actions.remove(builder);}} return (A)this;
}
/**
* This method has been deprecated, please use method buildActions instead.
* @return The buildable object.
*/
@Deprecated public List getActions(){
return build(actions);
}
public List buildActions(){
return build(actions);
}
public Action buildAction(int index){
return this.actions.get(index).build();
}
public Action buildFirstAction(){
return this.actions.get(0).build();
}
public Action buildLastAction(){
return this.actions.get(actions.size() - 1).build();
}
public Action buildMatchingAction(io.fabric8.kubernetes.api.builder.Predicate predicate){
for (ActionBuilder item: actions) { if(predicate.apply(item)){return item.build();} } return null;
}
public A withActions(List actions){
if (this.actions != null) { _visitables.removeAll(this.actions);}
if (actions != null) {this.actions = new ArrayList(); for (Action item : actions){this.addToActions(item);}} else { this.actions = null;} return (A) this;
}
public A withActions(Action... actions){
if (this.actions != null) {this.actions.clear();}
if (actions != null) {for (Action item :actions){ this.addToActions(item);}} return (A) this;
}
public Boolean hasActions(){
return actions != null && !actions.isEmpty();
}
public RuleSpecFluent.ActionsNested addNewAction(){
return new ActionsNestedImpl();
}
public RuleSpecFluent.ActionsNested addNewActionLike(Action item){
return new ActionsNestedImpl(-1, item);
}
public RuleSpecFluent.ActionsNested setNewActionLike(int index,Action item){
return new ActionsNestedImpl(index, item);
}
public RuleSpecFluent.ActionsNested editAction(int index){
if (actions.size() <= index) throw new RuntimeException("Can't edit actions. Index exceeds size.");
return setNewActionLike(index, buildAction(index));
}
public RuleSpecFluent.ActionsNested editFirstAction(){
if (actions.size() == 0) throw new RuntimeException("Can't edit first actions. The list is empty.");
return setNewActionLike(0, buildAction(0));
}
public RuleSpecFluent.ActionsNested editLastAction(){
int index = actions.size() - 1;
if (index < 0) throw new RuntimeException("Can't edit last actions. The list is empty.");
return setNewActionLike(index, buildAction(index));
}
public RuleSpecFluent.ActionsNested editMatchingAction(io.fabric8.kubernetes.api.builder.Predicate predicate){
int index = -1;
for (int i=0;i extends ActionFluentImpl> implements RuleSpecFluent.ActionsNested,io.fabric8.kubernetes.api.builder.Nested{
private final ActionBuilder builder;
private final int index;
ActionsNestedImpl(int index,Action item){
this.index = index;
this.builder = new ActionBuilder(this, item);
}
ActionsNestedImpl(){
this.index = -1;
this.builder = new ActionBuilder(this);
}
public N and(){
return (N) RuleSpecFluentImpl.this.setToActions(index, builder.build());
}
public N endAction(){
return and();
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy