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

io.fabric8.openshift.api.model.machine.v1.AWSResourceReferenceFluent Maven / Gradle / Ivy

There is a newer version: 6.13.4
Show newest version
package io.fabric8.openshift.api.model.machine.v1;

import io.fabric8.kubernetes.api.builder.VisitableBuilder;
import java.lang.SuppressWarnings;
import io.fabric8.kubernetes.api.builder.Nested;
import java.util.ArrayList;
import java.lang.String;
import java.util.LinkedHashMap;
import java.util.function.Predicate;
import io.fabric8.kubernetes.api.builder.BaseFluent;
import java.util.Iterator;
import java.util.Collection;
import java.lang.Object;
import java.util.List;
import java.util.Map;

/**
 * Generated
 */
@SuppressWarnings("unchecked")
public class AWSResourceReferenceFluent> extends BaseFluent{
  public AWSResourceReferenceFluent() {
  }
  
  public AWSResourceReferenceFluent(AWSResourceReference instance) {
    this.copyInstance(instance);
  }
  private String arn;
  private ArrayList filters = new ArrayList();
  private String id;
  private String type;
  private Map additionalProperties;
  
  protected void copyInstance(AWSResourceReference instance) {
    instance = (instance != null ? instance : new AWSResourceReference());
  
    if (instance != null) {
        this.withArn(instance.getArn());
        this.withFilters(instance.getFilters());
        this.withId(instance.getId());
        this.withType(instance.getType());
        this.withArn(instance.getArn());
        this.withFilters(instance.getFilters());
        this.withId(instance.getId());
        this.withType(instance.getType());
        this.withAdditionalProperties(instance.getAdditionalProperties());
      }
  }
  
  public String getArn() {
    return this.arn;
  }
  
  public A withArn(String arn) {
    this.arn=arn; return (A) this;
  }
  
  public boolean hasArn() {
    return this.arn != null;
  }
  
  public A addToFilters(int index,AWSResourceFilter item) {
    if (this.filters == null) {this.filters = new ArrayList();}
    AWSResourceFilterBuilder builder = new AWSResourceFilterBuilder(item);
    if (index < 0 || index >= filters.size()) { _visitables.get("filters").add(builder); filters.add(builder); } else { _visitables.get("filters").add(index, builder); filters.add(index, builder);}
    return (A)this;
  }
  
  public A setToFilters(int index,AWSResourceFilter item) {
    if (this.filters == null) {this.filters = new ArrayList();}
    AWSResourceFilterBuilder builder = new AWSResourceFilterBuilder(item);
    if (index < 0 || index >= filters.size()) { _visitables.get("filters").add(builder); filters.add(builder); } else { _visitables.get("filters").set(index, builder); filters.set(index, builder);}
    return (A)this;
  }
  
  public A addToFilters(io.fabric8.openshift.api.model.machine.v1.AWSResourceFilter... items) {
    if (this.filters == null) {this.filters = new ArrayList();}
    for (AWSResourceFilter item : items) {AWSResourceFilterBuilder builder = new AWSResourceFilterBuilder(item);_visitables.get("filters").add(builder);this.filters.add(builder);} return (A)this;
  }
  
  public A addAllToFilters(Collection items) {
    if (this.filters == null) {this.filters = new ArrayList();}
    for (AWSResourceFilter item : items) {AWSResourceFilterBuilder builder = new AWSResourceFilterBuilder(item);_visitables.get("filters").add(builder);this.filters.add(builder);} return (A)this;
  }
  
  public A removeFromFilters(io.fabric8.openshift.api.model.machine.v1.AWSResourceFilter... items) {
    if (this.filters == null) return (A)this;
    for (AWSResourceFilter item : items) {AWSResourceFilterBuilder builder = new AWSResourceFilterBuilder(item);_visitables.get("filters").remove(builder); this.filters.remove(builder);} return (A)this;
  }
  
  public A removeAllFromFilters(Collection items) {
    if (this.filters == null) return (A)this;
    for (AWSResourceFilter item : items) {AWSResourceFilterBuilder builder = new AWSResourceFilterBuilder(item);_visitables.get("filters").remove(builder); this.filters.remove(builder);} return (A)this;
  }
  
  public A removeMatchingFromFilters(Predicate predicate) {
    if (filters == null) return (A) this;
    final Iterator each = filters.iterator();
    final List visitables = _visitables.get("filters");
    while (each.hasNext()) {
      AWSResourceFilterBuilder builder = each.next();
      if (predicate.test(builder)) {
        visitables.remove(builder);
        each.remove();
      }
    }
    return (A)this;
  }
  
  public List buildFilters() {
    return filters != null ? build(filters) : null;
  }
  
  public AWSResourceFilter buildFilter(int index) {
    return this.filters.get(index).build();
  }
  
  public AWSResourceFilter buildFirstFilter() {
    return this.filters.get(0).build();
  }
  
  public AWSResourceFilter buildLastFilter() {
    return this.filters.get(filters.size() - 1).build();
  }
  
  public AWSResourceFilter buildMatchingFilter(Predicate predicate) {
    for (AWSResourceFilterBuilder item: filters) { if(predicate.test(item)){ return item.build();} } return null;
  }
  
  public boolean hasMatchingFilter(Predicate predicate) {
    for (AWSResourceFilterBuilder item: filters) { if(predicate.test(item)){ return true;} } return false;
  }
  
  public A withFilters(List filters) {
    if (this.filters != null) { _visitables.get("filters").clear();}
    if (filters != null) {this.filters = new ArrayList(); for (AWSResourceFilter item : filters){this.addToFilters(item);}} else { this.filters = null;} return (A) this;
  }
  
  public A withFilters(io.fabric8.openshift.api.model.machine.v1.AWSResourceFilter... filters) {
    if (this.filters != null) {this.filters.clear(); _visitables.remove("filters"); }
    if (filters != null) {for (AWSResourceFilter item :filters){ this.addToFilters(item);}} return (A) this;
  }
  
  public boolean hasFilters() {
    return filters != null && !filters.isEmpty();
  }
  
  public FiltersNested addNewFilter() {
    return new FiltersNested(-1, null);
  }
  
  public FiltersNested addNewFilterLike(AWSResourceFilter item) {
    return new FiltersNested(-1, item);
  }
  
  public FiltersNested setNewFilterLike(int index,AWSResourceFilter item) {
    return new FiltersNested(index, item);
  }
  
  public FiltersNested editFilter(int index) {
    if (filters.size() <= index) throw new RuntimeException("Can't edit filters. Index exceeds size.");
    return setNewFilterLike(index, buildFilter(index));
  }
  
  public FiltersNested editFirstFilter() {
    if (filters.size() == 0) throw new RuntimeException("Can't edit first filters. The list is empty.");
    return setNewFilterLike(0, buildFilter(0));
  }
  
  public FiltersNested editLastFilter() {
    int index = filters.size() - 1;
    if (index < 0) throw new RuntimeException("Can't edit last filters. The list is empty.");
    return setNewFilterLike(index, buildFilter(index));
  }
  
  public FiltersNested editMatchingFilter(Predicate predicate) {
    int index = -1;
    for (int i=0;i map) {
    if(this.additionalProperties == null && map != null) { this.additionalProperties = new LinkedHashMap(); }
    if(map != null) { this.additionalProperties.putAll(map);} return (A)this;
  }
  
  public A removeFromAdditionalProperties(String key) {
    if(this.additionalProperties == null) { return (A) this; }
    if(key != null && this.additionalProperties != null) {this.additionalProperties.remove(key);} return (A)this;
  }
  
  public A removeFromAdditionalProperties(Map map) {
    if(this.additionalProperties == null) { return (A) this; }
    if(map != null) { for(Object key : map.keySet()) {if (this.additionalProperties != null){this.additionalProperties.remove(key);}}} return (A)this;
  }
  
  public Map getAdditionalProperties() {
    return this.additionalProperties;
  }
  
  public A withAdditionalProperties(Map additionalProperties) {
    if (additionalProperties == null) { this.additionalProperties =  null;} else {this.additionalProperties = new LinkedHashMap(additionalProperties);} return (A) this;
  }
  
  public boolean hasAdditionalProperties() {
    return this.additionalProperties != null;
  }
  
  public boolean equals(Object o) {
    if (this == o) return true;
    if (o == null || getClass() != o.getClass()) return false;
    if (!super.equals(o)) return false;
    AWSResourceReferenceFluent that = (AWSResourceReferenceFluent) o;
    if (!java.util.Objects.equals(arn, that.arn)) return false;
  
    if (!java.util.Objects.equals(filters, that.filters)) return false;
  
    if (!java.util.Objects.equals(id, that.id)) return false;
  
    if (!java.util.Objects.equals(type, that.type)) return false;
  
    if (!java.util.Objects.equals(additionalProperties, that.additionalProperties)) return false;
  
    return true;
  }
  
  public int hashCode() {
    return java.util.Objects.hash(arn,  filters,  id,  type,  additionalProperties,  super.hashCode());
  }
  
  public String toString() {
    StringBuilder sb = new StringBuilder();
    sb.append("{");
    if (arn != null) { sb.append("arn:"); sb.append(arn + ","); }
    if (filters != null && !filters.isEmpty()) { sb.append("filters:"); sb.append(filters + ","); }
    if (id != null) { sb.append("id:"); sb.append(id + ","); }
    if (type != null) { sb.append("type:"); sb.append(type + ","); }
    if (additionalProperties != null && !additionalProperties.isEmpty()) { sb.append("additionalProperties:"); sb.append(additionalProperties); }
    sb.append("}");
    return sb.toString();
  }
  public class FiltersNested extends AWSResourceFilterFluent> implements Nested{
    FiltersNested(int index,AWSResourceFilter item) {
      this.index = index;
      this.builder = new AWSResourceFilterBuilder(this, item);
    }
    AWSResourceFilterBuilder builder;
    int index;
    
    public N and() {
      return (N) AWSResourceReferenceFluent.this.setToFilters(index,builder.build());
    }
    
    public N endFilter() {
      return and();
    }
    
  
  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy