All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.dekorate.halkyon.config.ComponentConfigFluentImpl Maven / Gradle / Ivy

There is a newer version: 2.0.0.beta2
Show newest version
package io.dekorate.halkyon.config;

import io.dekorate.deps.kubernetes.api.builder.VisitableBuilder;
import io.dekorate.kubernetes.config.LabelFluentImpl;
import java.lang.StringBuilder;
import io.dekorate.deps.kubernetes.api.builder.Nested;
import io.dekorate.kubernetes.config.Label;
import java.util.ArrayList;
import java.lang.String;
import io.dekorate.kubernetes.config.Env;
import io.dekorate.deps.kubernetes.api.builder.Predicate;
import java.lang.Deprecated;
import java.util.Iterator;
import io.dekorate.halkyon.model.DeploymentMode;
import io.dekorate.kubernetes.config.LabelBuilder;
import java.util.List;
import java.lang.Boolean;
import io.dekorate.kubernetes.config.ConfigurationFluentImpl;
import java.lang.StringBuffer;
import io.dekorate.kubernetes.config.EnvBuilder;
import io.dekorate.kubernetes.config.EnvFluentImpl;
import java.util.Collection;
import java.lang.Object;

public class ComponentConfigFluentImpl> extends ConfigurationFluentImpl implements ComponentConfigFluent{

    private String partOf = "";
    private String name = "";
    private String version = "";
    private DeploymentMode deploymentMode = io.dekorate.halkyon.model.DeploymentMode.dev;
    private boolean exposeService = false;
    private List envs =  new ArrayList();
    private List labels =  new ArrayList();
    private String buildType = "s2i";
    private String remote = "origin";
    private List provides =  new ArrayList();
    private List requires =  new ArrayList();

    public ComponentConfigFluentImpl(){
    }
    public ComponentConfigFluentImpl(ComponentConfig instance){
            this.withProject(instance.getProject()); 
            this.withAttributes(instance.getAttributes()); 
            this.withPartOf(instance.getPartOf()); 
            this.withName(instance.getName()); 
            this.withVersion(instance.getVersion()); 
            this.withDeploymentMode(instance.getDeploymentMode()); 
            this.withExposeService(instance.isExposeService()); 
            this.withEnvs(instance.getEnvs()); 
            this.withLabels(instance.getLabels()); 
            this.withBuildType(instance.getBuildType()); 
            this.withRemote(instance.getRemote()); 
            this.withProvides(instance.getProvides()); 
            this.withRequires(instance.getRequires()); 
    }

    public String getPartOf(){
            return this.partOf;
    }

    public A withPartOf(String partOf){
            this.partOf=partOf; return (A) this;
    }

    public Boolean hasPartOf(){
            return this.partOf != null;
    }

    public A withNewPartOf(String arg1){
            return (A)withPartOf(new String(arg1));
    }

    public A withNewPartOf(StringBuilder arg1){
            return (A)withPartOf(new String(arg1));
    }

    public A withNewPartOf(StringBuffer arg1){
            return (A)withPartOf(new String(arg1));
    }

    public String getName(){
            return this.name;
    }

    public A withName(String name){
            this.name=name; return (A) this;
    }

    public Boolean hasName(){
            return this.name != null;
    }

    public A withNewName(String arg1){
            return (A)withName(new String(arg1));
    }

    public A withNewName(StringBuilder arg1){
            return (A)withName(new String(arg1));
    }

    public A withNewName(StringBuffer arg1){
            return (A)withName(new String(arg1));
    }

    public String getVersion(){
            return this.version;
    }

    public A withVersion(String version){
            this.version=version; return (A) this;
    }

    public Boolean hasVersion(){
            return this.version != null;
    }

    public A withNewVersion(String arg1){
            return (A)withVersion(new String(arg1));
    }

    public A withNewVersion(StringBuilder arg1){
            return (A)withVersion(new String(arg1));
    }

    public A withNewVersion(StringBuffer arg1){
            return (A)withVersion(new String(arg1));
    }

    public DeploymentMode getDeploymentMode(){
            return this.deploymentMode;
    }

    public A withDeploymentMode(DeploymentMode deploymentMode){
            this.deploymentMode=deploymentMode; return (A) this;
    }

    public Boolean hasDeploymentMode(){
            return this.deploymentMode != null;
    }

    public boolean isExposeService(){
            return this.exposeService;
    }

    public A withExposeService(boolean exposeService){
            this.exposeService=exposeService; return (A) this;
    }

    public Boolean hasExposeService(){
            return true;
    }

    public A withEnvs(io.dekorate.kubernetes.config.Env... envs){
            if (this.envs != null) {this.envs.clear();}
            if (envs != null) {for (io.dekorate.kubernetes.config.Env item :envs){ this.addToEnvs(item);}} return (A) this;
    }

    
/**
 * This method has been deprecated, please use method buildEnvs instead.
 */
@Deprecated public io.dekorate.kubernetes.config.Env[] getEnvs(){
            int size = envs != null ? envs.size() : 0;
io.dekorate.kubernetes.config.Env[] result = new io.dekorate.kubernetes.config.Env[size];
if (size == 0) {
   return result;
}
int index = 0;
for (VisitableBuilder builder : envs) {
    result[index++]=builder.build();
}
return result;

    }

    public io.dekorate.kubernetes.config.Env[] buildEnvs(){
            int size = envs != null ? envs.size() : 0;
io.dekorate.kubernetes.config.Env[] result = new io.dekorate.kubernetes.config.Env[size];
if (size == 0) {
   return result;
}
int index = 0;
for (VisitableBuilder builder : envs) {
    result[index++]=builder.build();
}
return result;

    }

    public io.dekorate.kubernetes.config.Env buildEnv(int index){
            return this.envs.get(index).build();
    }

    public io.dekorate.kubernetes.config.Env buildFirstEnv(){
            return this.envs.get(0).build();
    }

    public io.dekorate.kubernetes.config.Env buildLastEnv(){
            return this.envs.get(envs.size() - 1).build();
    }

    public io.dekorate.kubernetes.config.Env buildMatchingEnv(io.dekorate.deps.kubernetes.api.builder.Predicate predicate){
            for (io.dekorate.kubernetes.config.EnvBuilder item: envs) { if(predicate.apply(item)){ return item.build();} } return null;
    }

    public Boolean hasMatchingEnv(io.dekorate.deps.kubernetes.api.builder.Predicate predicate){
            for (io.dekorate.kubernetes.config.EnvBuilder item: envs) { if(predicate.apply(item)){ return true;} } return false;
    }

    public A addToEnvs(int index,io.dekorate.kubernetes.config.Env item){
            if (this.envs == null) {this.envs = new ArrayList();}
            io.dekorate.kubernetes.config.EnvBuilder builder = new io.dekorate.kubernetes.config.EnvBuilder(item);_visitables.get("envs").add(index >= 0 ? index : _visitables.get("envs").size(), builder);this.envs.add(index >= 0 ? index : envs.size(), builder); return (A)this;
    }

    public A setToEnvs(int index,io.dekorate.kubernetes.config.Env item){
            if (this.envs == null) {this.envs = new ArrayList();}
            io.dekorate.kubernetes.config.EnvBuilder builder = new io.dekorate.kubernetes.config.EnvBuilder(item);
            if (index < 0 || index >= _visitables.get("envs").size()) { _visitables.get("envs").add(builder); } else { _visitables.get("envs").set(index, builder);}
            if (index < 0 || index >= envs.size()) { envs.add(builder); } else { envs.set(index, builder);}
             return (A)this;
    }

    public A addToEnvs(io.dekorate.kubernetes.config.Env... items){
            if (this.envs == null) {this.envs = new ArrayList();}
            for (io.dekorate.kubernetes.config.Env item : items) {io.dekorate.kubernetes.config.EnvBuilder builder = new io.dekorate.kubernetes.config.EnvBuilder(item);_visitables.get("envs").add(builder);this.envs.add(builder);} return (A)this;
    }

    public A addAllToConfigEnvs(Collection items){
            if (this.envs == null) {this.envs = new ArrayList();}
            for (io.dekorate.kubernetes.config.Env item : items) {io.dekorate.kubernetes.config.EnvBuilder builder = new io.dekorate.kubernetes.config.EnvBuilder(item);_visitables.get("envs").add(builder);this.envs.add(builder);} return (A)this;
    }

    public A removeFromEnvs(io.dekorate.kubernetes.config.Env... items){
            for (io.dekorate.kubernetes.config.Env item : items) {io.dekorate.kubernetes.config.EnvBuilder builder = new io.dekorate.kubernetes.config.EnvBuilder(item);_visitables.get("envs").remove(builder);if (this.envs != null) {this.envs.remove(builder);}} return (A)this;
    }

    public A removeAllFromConfigEnvs(Collection items){
            for (io.dekorate.kubernetes.config.Env item : items) {io.dekorate.kubernetes.config.EnvBuilder builder = new io.dekorate.kubernetes.config.EnvBuilder(item);_visitables.get("envs").remove(builder);if (this.envs != null) {this.envs.remove(builder);}} return (A)this;
    }

    public A removeMatchingFromConfigEnvs(io.dekorate.deps.kubernetes.api.builder.Predicate predicate){
            if (envs == null) return (A) this;
            final Iterator each = envs.iterator();
            final List visitables = _visitables.get("envs");
            while (each.hasNext()) {
              io.dekorate.kubernetes.config.EnvBuilder builder = each.next();
              if (predicate.apply(builder)) {
                visitables.remove(builder);
                each.remove();
              }
            }
            return (A)this;
    }

    public Boolean hasEnvs(){
            return envs != null && !envs.isEmpty();
    }

    public A addNewConfigEnv(String name,String value,String secret,String configmap,String field){
            return (A)addToEnvs(new Env(name, value, secret, configmap, field));
    }

    public ComponentConfigFluent.ConfigEnvsNested addNewConfigEnv(){
            return new ConfigEnvsNestedImpl();
    }

    public ComponentConfigFluent.ConfigEnvsNested addNewEnvLike(io.dekorate.kubernetes.config.Env item){
            return new ConfigEnvsNestedImpl(-1, item);
    }

    public ComponentConfigFluent.ConfigEnvsNested setNewEnvLike(int index,io.dekorate.kubernetes.config.Env item){
            return new ConfigEnvsNestedImpl(index, item);
    }

    public ComponentConfigFluent.ConfigEnvsNested editEnv(int index){
            if (envs.size() <= index) throw new RuntimeException("Can't edit envs. Index exceeds size.");
            return setNewEnvLike(index, buildEnv(index));
    }

    public ComponentConfigFluent.ConfigEnvsNested editFirstEnv(){
            if (envs.size() == 0) throw new RuntimeException("Can't edit first envs. The list is empty.");
            return setNewEnvLike(0, buildEnv(0));
    }

    public ComponentConfigFluent.ConfigEnvsNested editLastEnv(){
            int index = envs.size() - 1;
            if (index < 0) throw new RuntimeException("Can't edit last envs. The list is empty.");
            return setNewEnvLike(index, buildEnv(index));
    }

    public ComponentConfigFluent.ConfigEnvsNested editMatchingEnv(io.dekorate.deps.kubernetes.api.builder.Predicate predicate){
            int index = -1;
            for (int i=0;i builder : labels) {
    result[index++]=builder.build();
}
return result;

    }

    public io.dekorate.kubernetes.config.Label[] buildLabels(){
            int size = labels != null ? labels.size() : 0;
io.dekorate.kubernetes.config.Label[] result = new io.dekorate.kubernetes.config.Label[size];
if (size == 0) {
   return result;
}
int index = 0;
for (VisitableBuilder builder : labels) {
    result[index++]=builder.build();
}
return result;

    }

    public io.dekorate.kubernetes.config.Label buildLabel(int index){
            return this.labels.get(index).build();
    }

    public io.dekorate.kubernetes.config.Label buildFirstLabel(){
            return this.labels.get(0).build();
    }

    public io.dekorate.kubernetes.config.Label buildLastLabel(){
            return this.labels.get(labels.size() - 1).build();
    }

    public io.dekorate.kubernetes.config.Label buildMatchingLabel(io.dekorate.deps.kubernetes.api.builder.Predicate predicate){
            for (LabelBuilder item: labels) { if(predicate.apply(item)){ return item.build();} } return null;
    }

    public Boolean hasMatchingLabel(io.dekorate.deps.kubernetes.api.builder.Predicate predicate){
            for (LabelBuilder item: labels) { if(predicate.apply(item)){ return true;} } return false;
    }

    public A addToLabels(int index,io.dekorate.kubernetes.config.Label item){
            if (this.labels == null) {this.labels = new ArrayList();}
            io.dekorate.kubernetes.config.LabelBuilder builder = new io.dekorate.kubernetes.config.LabelBuilder(item);_visitables.get("labels").add(index >= 0 ? index : _visitables.get("labels").size(), builder);this.labels.add(index >= 0 ? index : labels.size(), builder); return (A)this;
    }

    public A setToLabels(int index,io.dekorate.kubernetes.config.Label item){
            if (this.labels == null) {this.labels = new ArrayList();}
            io.dekorate.kubernetes.config.LabelBuilder builder = new io.dekorate.kubernetes.config.LabelBuilder(item);
            if (index < 0 || index >= _visitables.get("labels").size()) { _visitables.get("labels").add(builder); } else { _visitables.get("labels").set(index, builder);}
            if (index < 0 || index >= labels.size()) { labels.add(builder); } else { labels.set(index, builder);}
             return (A)this;
    }

    public A addToLabels(io.dekorate.kubernetes.config.Label... items){
            if (this.labels == null) {this.labels = new ArrayList();}
            for (io.dekorate.kubernetes.config.Label item : items) {io.dekorate.kubernetes.config.LabelBuilder builder = new io.dekorate.kubernetes.config.LabelBuilder(item);_visitables.get("labels").add(builder);this.labels.add(builder);} return (A)this;
    }

    public A addAllToConfigLabels(Collection items){
            if (this.labels == null) {this.labels = new ArrayList();}
            for (io.dekorate.kubernetes.config.Label item : items) {io.dekorate.kubernetes.config.LabelBuilder builder = new io.dekorate.kubernetes.config.LabelBuilder(item);_visitables.get("labels").add(builder);this.labels.add(builder);} return (A)this;
    }

    public A removeFromLabels(io.dekorate.kubernetes.config.Label... items){
            for (io.dekorate.kubernetes.config.Label item : items) {io.dekorate.kubernetes.config.LabelBuilder builder = new io.dekorate.kubernetes.config.LabelBuilder(item);_visitables.get("labels").remove(builder);if (this.labels != null) {this.labels.remove(builder);}} return (A)this;
    }

    public A removeAllFromConfigLabels(Collection items){
            for (io.dekorate.kubernetes.config.Label item : items) {io.dekorate.kubernetes.config.LabelBuilder builder = new io.dekorate.kubernetes.config.LabelBuilder(item);_visitables.get("labels").remove(builder);if (this.labels != null) {this.labels.remove(builder);}} return (A)this;
    }

    public A removeMatchingFromConfigLabels(io.dekorate.deps.kubernetes.api.builder.Predicate predicate){
            if (labels == null) return (A) this;
            final Iterator each = labels.iterator();
            final List visitables = _visitables.get("labels");
            while (each.hasNext()) {
              LabelBuilder builder = each.next();
              if (predicate.apply(builder)) {
                visitables.remove(builder);
                each.remove();
              }
            }
            return (A)this;
    }

    public Boolean hasLabels(){
            return labels != null && !labels.isEmpty();
    }

    public A addNewConfigLabel(String key,String value){
            return (A)addToLabels(new Label(key, value));
    }

    public ComponentConfigFluent.ConfigLabelsNested addNewConfigLabel(){
            return new ConfigLabelsNestedImpl();
    }

    public ComponentConfigFluent.ConfigLabelsNested addNewLabelLike(io.dekorate.kubernetes.config.Label item){
            return new ConfigLabelsNestedImpl(-1, item);
    }

    public ComponentConfigFluent.ConfigLabelsNested setNewLabelLike(int index,io.dekorate.kubernetes.config.Label item){
            return new ConfigLabelsNestedImpl(index, item);
    }

    public ComponentConfigFluent.ConfigLabelsNested editLabel(int index){
            if (labels.size() <= index) throw new RuntimeException("Can't edit labels. Index exceeds size.");
            return setNewLabelLike(index, buildLabel(index));
    }

    public ComponentConfigFluent.ConfigLabelsNested editFirstLabel(){
            if (labels.size() == 0) throw new RuntimeException("Can't edit first labels. The list is empty.");
            return setNewLabelLike(0, buildLabel(0));
    }

    public ComponentConfigFluent.ConfigLabelsNested editLastLabel(){
            int index = labels.size() - 1;
            if (index < 0) throw new RuntimeException("Can't edit last labels. The list is empty.");
            return setNewLabelLike(index, buildLabel(index));
    }

    public ComponentConfigFluent.ConfigLabelsNested editMatchingLabel(io.dekorate.deps.kubernetes.api.builder.Predicate predicate){
            int index = -1;
            for (int i=0;i builder : provides) {
    result[index++]=builder.build();
}
return result;

    }

    public CapabilityConfig[] buildProvides(){
            int size = provides != null ? provides.size() : 0;
CapabilityConfig[] result = new CapabilityConfig[size];
if (size == 0) {
   return result;
}
int index = 0;
for (VisitableBuilder builder : provides) {
    result[index++]=builder.build();
}
return result;

    }

    public CapabilityConfig buildProvide(int index){
            return this.provides.get(index).build();
    }

    public CapabilityConfig buildFirstProvide(){
            return this.provides.get(0).build();
    }

    public CapabilityConfig buildLastProvide(){
            return this.provides.get(provides.size() - 1).build();
    }

    public CapabilityConfig buildMatchingProvide(io.dekorate.deps.kubernetes.api.builder.Predicate predicate){
            for (CapabilityConfigBuilder item: provides) { if(predicate.apply(item)){ return item.build();} } return null;
    }

    public Boolean hasMatchingProvide(io.dekorate.deps.kubernetes.api.builder.Predicate predicate){
            for (CapabilityConfigBuilder item: provides) { if(predicate.apply(item)){ return true;} } return false;
    }

    public A addToProvides(int index,CapabilityConfig item){
            if (this.provides == null) {this.provides = new ArrayList();}
            CapabilityConfigBuilder builder = new CapabilityConfigBuilder(item);_visitables.get("provides").add(index >= 0 ? index : _visitables.get("provides").size(), builder);this.provides.add(index >= 0 ? index : provides.size(), builder); return (A)this;
    }

    public A setToProvides(int index,CapabilityConfig item){
            if (this.provides == null) {this.provides = new ArrayList();}
            CapabilityConfigBuilder builder = new CapabilityConfigBuilder(item);
            if (index < 0 || index >= _visitables.get("provides").size()) { _visitables.get("provides").add(builder); } else { _visitables.get("provides").set(index, builder);}
            if (index < 0 || index >= provides.size()) { provides.add(builder); } else { provides.set(index, builder);}
             return (A)this;
    }

    public A addToProvides(CapabilityConfig... items){
            if (this.provides == null) {this.provides = new ArrayList();}
            for (CapabilityConfig item : items) {CapabilityConfigBuilder builder = new CapabilityConfigBuilder(item);_visitables.get("provides").add(builder);this.provides.add(builder);} return (A)this;
    }

    public A addAllToProvides(Collection items){
            if (this.provides == null) {this.provides = new ArrayList();}
            for (CapabilityConfig item : items) {CapabilityConfigBuilder builder = new CapabilityConfigBuilder(item);_visitables.get("provides").add(builder);this.provides.add(builder);} return (A)this;
    }

    public A removeFromProvides(CapabilityConfig... items){
            for (CapabilityConfig item : items) {CapabilityConfigBuilder builder = new CapabilityConfigBuilder(item);_visitables.get("provides").remove(builder);if (this.provides != null) {this.provides.remove(builder);}} return (A)this;
    }

    public A removeAllFromProvides(Collection items){
            for (CapabilityConfig item : items) {CapabilityConfigBuilder builder = new CapabilityConfigBuilder(item);_visitables.get("provides").remove(builder);if (this.provides != null) {this.provides.remove(builder);}} return (A)this;
    }

    public A removeMatchingFromProvides(io.dekorate.deps.kubernetes.api.builder.Predicate predicate){
            if (provides == null) return (A) this;
            final Iterator each = provides.iterator();
            final List visitables = _visitables.get("provides");
            while (each.hasNext()) {
              CapabilityConfigBuilder builder = each.next();
              if (predicate.apply(builder)) {
                visitables.remove(builder);
                each.remove();
              }
            }
            return (A)this;
    }

    public Boolean hasProvides(){
            return provides != null && !provides.isEmpty();
    }

    public ComponentConfigFluent.ProvidesNested addNewProvide(){
            return new ProvidesNestedImpl();
    }

    public ComponentConfigFluent.ProvidesNested addNewProvideLike(CapabilityConfig item){
            return new ProvidesNestedImpl(-1, item);
    }

    public ComponentConfigFluent.ProvidesNested setNewProvideLike(int index,CapabilityConfig item){
            return new ProvidesNestedImpl(index, item);
    }

    public ComponentConfigFluent.ProvidesNested editProvide(int index){
            if (provides.size() <= index) throw new RuntimeException("Can't edit provides. Index exceeds size.");
            return setNewProvideLike(index, buildProvide(index));
    }

    public ComponentConfigFluent.ProvidesNested editFirstProvide(){
            if (provides.size() == 0) throw new RuntimeException("Can't edit first provides. The list is empty.");
            return setNewProvideLike(0, buildProvide(0));
    }

    public ComponentConfigFluent.ProvidesNested editLastProvide(){
            int index = provides.size() - 1;
            if (index < 0) throw new RuntimeException("Can't edit last provides. The list is empty.");
            return setNewProvideLike(index, buildProvide(index));
    }

    public ComponentConfigFluent.ProvidesNested editMatchingProvide(io.dekorate.deps.kubernetes.api.builder.Predicate predicate){
            int index = -1;
            for (int i=0;i builder : requires) {
    result[index++]=builder.build();
}
return result;

    }

    public RequiredCapabilityConfig[] buildRequires(){
            int size = requires != null ? requires.size() : 0;
RequiredCapabilityConfig[] result = new RequiredCapabilityConfig[size];
if (size == 0) {
   return result;
}
int index = 0;
for (VisitableBuilder builder : requires) {
    result[index++]=builder.build();
}
return result;

    }

    public RequiredCapabilityConfig buildRequire(int index){
            return this.requires.get(index).build();
    }

    public RequiredCapabilityConfig buildFirstRequire(){
            return this.requires.get(0).build();
    }

    public RequiredCapabilityConfig buildLastRequire(){
            return this.requires.get(requires.size() - 1).build();
    }

    public RequiredCapabilityConfig buildMatchingRequire(io.dekorate.deps.kubernetes.api.builder.Predicate predicate){
            for (RequiredCapabilityConfigBuilder item: requires) { if(predicate.apply(item)){ return item.build();} } return null;
    }

    public Boolean hasMatchingRequire(io.dekorate.deps.kubernetes.api.builder.Predicate predicate){
            for (RequiredCapabilityConfigBuilder item: requires) { if(predicate.apply(item)){ return true;} } return false;
    }

    public A addToRequires(int index,RequiredCapabilityConfig item){
            if (this.requires == null) {this.requires = new ArrayList();}
            RequiredCapabilityConfigBuilder builder = new RequiredCapabilityConfigBuilder(item);_visitables.get("requires").add(index >= 0 ? index : _visitables.get("requires").size(), builder);this.requires.add(index >= 0 ? index : requires.size(), builder); return (A)this;
    }

    public A setToRequires(int index,RequiredCapabilityConfig item){
            if (this.requires == null) {this.requires = new ArrayList();}
            RequiredCapabilityConfigBuilder builder = new RequiredCapabilityConfigBuilder(item);
            if (index < 0 || index >= _visitables.get("requires").size()) { _visitables.get("requires").add(builder); } else { _visitables.get("requires").set(index, builder);}
            if (index < 0 || index >= requires.size()) { requires.add(builder); } else { requires.set(index, builder);}
             return (A)this;
    }

    public A addToRequires(RequiredCapabilityConfig... items){
            if (this.requires == null) {this.requires = new ArrayList();}
            for (RequiredCapabilityConfig item : items) {RequiredCapabilityConfigBuilder builder = new RequiredCapabilityConfigBuilder(item);_visitables.get("requires").add(builder);this.requires.add(builder);} return (A)this;
    }

    public A addAllToRequires(Collection items){
            if (this.requires == null) {this.requires = new ArrayList();}
            for (RequiredCapabilityConfig item : items) {RequiredCapabilityConfigBuilder builder = new RequiredCapabilityConfigBuilder(item);_visitables.get("requires").add(builder);this.requires.add(builder);} return (A)this;
    }

    public A removeFromRequires(RequiredCapabilityConfig... items){
            for (RequiredCapabilityConfig item : items) {RequiredCapabilityConfigBuilder builder = new RequiredCapabilityConfigBuilder(item);_visitables.get("requires").remove(builder);if (this.requires != null) {this.requires.remove(builder);}} return (A)this;
    }

    public A removeAllFromRequires(Collection items){
            for (RequiredCapabilityConfig item : items) {RequiredCapabilityConfigBuilder builder = new RequiredCapabilityConfigBuilder(item);_visitables.get("requires").remove(builder);if (this.requires != null) {this.requires.remove(builder);}} return (A)this;
    }

    public A removeMatchingFromRequires(io.dekorate.deps.kubernetes.api.builder.Predicate predicate){
            if (requires == null) return (A) this;
            final Iterator each = requires.iterator();
            final List visitables = _visitables.get("requires");
            while (each.hasNext()) {
              RequiredCapabilityConfigBuilder builder = each.next();
              if (predicate.apply(builder)) {
                visitables.remove(builder);
                each.remove();
              }
            }
            return (A)this;
    }

    public Boolean hasRequires(){
            return requires != null && !requires.isEmpty();
    }

    public ComponentConfigFluent.RequiresNested addNewRequire(){
            return new RequiresNestedImpl();
    }

    public ComponentConfigFluent.RequiresNested addNewRequireLike(RequiredCapabilityConfig item){
            return new RequiresNestedImpl(-1, item);
    }

    public ComponentConfigFluent.RequiresNested setNewRequireLike(int index,RequiredCapabilityConfig item){
            return new RequiresNestedImpl(index, item);
    }

    public ComponentConfigFluent.RequiresNested editRequire(int index){
            if (requires.size() <= index) throw new RuntimeException("Can't edit requires. Index exceeds size.");
            return setNewRequireLike(index, buildRequire(index));
    }

    public ComponentConfigFluent.RequiresNested editFirstRequire(){
            if (requires.size() == 0) throw new RuntimeException("Can't edit first requires. The list is empty.");
            return setNewRequireLike(0, buildRequire(0));
    }

    public ComponentConfigFluent.RequiresNested editLastRequire(){
            int index = requires.size() - 1;
            if (index < 0) throw new RuntimeException("Can't edit last requires. The list is empty.");
            return setNewRequireLike(index, buildRequire(index));
    }

    public ComponentConfigFluent.RequiresNested editMatchingRequire(io.dekorate.deps.kubernetes.api.builder.Predicate predicate){
            int index = -1;
            for (int i=0;i extends io.dekorate.kubernetes.config.EnvFluentImpl> implements ComponentConfigFluent.ConfigEnvsNested,io.dekorate.deps.kubernetes.api.builder.Nested{

            private final io.dekorate.kubernetes.config.EnvBuilder builder;
        private final int index;
    
            ConfigEnvsNestedImpl(int index,io.dekorate.kubernetes.config.Env item){
                    this.index = index;
                    this.builder = new io.dekorate.kubernetes.config.EnvBuilder(this, item);
            }
            ConfigEnvsNestedImpl(){
                    this.index = -1;
                    this.builder = new io.dekorate.kubernetes.config.EnvBuilder(this);
            }
    
    public N and(){
            return (N) ComponentConfigFluentImpl.this.setToEnvs(index,builder.build());
    }
    public N endConfigEnv(){
            return and();
    }

}
    public class ConfigLabelsNestedImpl extends LabelFluentImpl> implements ComponentConfigFluent.ConfigLabelsNested,io.dekorate.deps.kubernetes.api.builder.Nested{

            private final LabelBuilder builder;
        private final int index;
    
            ConfigLabelsNestedImpl(int index,io.dekorate.kubernetes.config.Label item){
                    this.index = index;
                    this.builder = new LabelBuilder(this, item);
            }
            ConfigLabelsNestedImpl(){
                    this.index = -1;
                    this.builder = new LabelBuilder(this);
            }
    
    public N and(){
            return (N) ComponentConfigFluentImpl.this.setToLabels(index,builder.build());
    }
    public N endConfigLabel(){
            return and();
    }

}
    public class ProvidesNestedImpl extends CapabilityConfigFluentImpl> implements ComponentConfigFluent.ProvidesNested,io.dekorate.deps.kubernetes.api.builder.Nested{

            private final CapabilityConfigBuilder builder;
        private final int index;
    
            ProvidesNestedImpl(int index,CapabilityConfig item){
                    this.index = index;
                    this.builder = new CapabilityConfigBuilder(this, item);
            }
            ProvidesNestedImpl(){
                    this.index = -1;
                    this.builder = new CapabilityConfigBuilder(this);
            }
    
    public N and(){
            return (N) ComponentConfigFluentImpl.this.setToProvides(index,builder.build());
    }
    public N endProvide(){
            return and();
    }

}
    public class RequiresNestedImpl extends RequiredCapabilityConfigFluentImpl> implements ComponentConfigFluent.RequiresNested,io.dekorate.deps.kubernetes.api.builder.Nested{

            private final RequiredCapabilityConfigBuilder builder;
        private final int index;
    
            RequiresNestedImpl(int index,RequiredCapabilityConfig item){
                    this.index = index;
                    this.builder = new RequiredCapabilityConfigBuilder(this, item);
            }
            RequiresNestedImpl(){
                    this.index = -1;
                    this.builder = new RequiredCapabilityConfigBuilder(this);
            }
    
    public N and(){
            return (N) ComponentConfigFluentImpl.this.setToRequires(index,builder.build());
    }
    public N endRequire(){
            return and();
    }

}


}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy