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

io.fabric8.openshift.api.model.installer.aws.v1.MetadataFluent Maven / Gradle / Ivy

package io.fabric8.openshift.api.model.installer.aws.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 MetadataFluent> extends BaseFluent{
  public MetadataFluent() {
  }
  
  public MetadataFluent(Metadata instance) {
    this.copyInstance(instance);
  }
  private String clusterDomain;
  private String hostedZoneRole;
  private List> identifier = new ArrayList>();
  private String region;
  private ArrayList serviceEndpoints = new ArrayList();
  private Map additionalProperties;
  
  protected void copyInstance(Metadata instance) {
    instance = (instance != null ? instance : new Metadata());
    if (instance != null) {
          this.withClusterDomain(instance.getClusterDomain());
          this.withHostedZoneRole(instance.getHostedZoneRole());
          this.withIdentifier(instance.getIdentifier());
          this.withRegion(instance.getRegion());
          this.withServiceEndpoints(instance.getServiceEndpoints());
          this.withAdditionalProperties(instance.getAdditionalProperties());
        }
  }
  
  public String getClusterDomain() {
    return this.clusterDomain;
  }
  
  public A withClusterDomain(String clusterDomain) {
    this.clusterDomain = clusterDomain;
    return (A) this;
  }
  
  public boolean hasClusterDomain() {
    return this.clusterDomain != null;
  }
  
  public String getHostedZoneRole() {
    return this.hostedZoneRole;
  }
  
  public A withHostedZoneRole(String hostedZoneRole) {
    this.hostedZoneRole = hostedZoneRole;
    return (A) this;
  }
  
  public boolean hasHostedZoneRole() {
    return this.hostedZoneRole != null;
  }
  
  public A addToIdentifier(int index,Map item) {
    if (this.identifier == null) {this.identifier = new ArrayList>();}
    this.identifier.add(index, item);
    return (A)this;
  }
  
  public A setToIdentifier(int index,Map item) {
    if (this.identifier == null) {this.identifier = new ArrayList>();}
    this.identifier.set(index, item); return (A)this;
  }
  
  public A addToIdentifier(Map... items) {
    if (this.identifier == null) {this.identifier = new ArrayList>();}
    for (Map item : items) {this.identifier.add(item);} return (A)this;
  }
  
  public A addAllToIdentifier(Collection> items) {
    if (this.identifier == null) {this.identifier = new ArrayList>();}
    for (Map item : items) {this.identifier.add(item);} return (A)this;
  }
  
  public A removeFromIdentifier(Map... items) {
    if (this.identifier == null) return (A)this;
    for (Map item : items) { this.identifier.remove(item);} return (A)this;
  }
  
  public A removeAllFromIdentifier(Collection> items) {
    if (this.identifier == null) return (A)this;
    for (Map item : items) { this.identifier.remove(item);} return (A)this;
  }
  
  public List> getIdentifier() {
    return this.identifier;
  }
  
  public Map getIdentifier(int index) {
    return this.identifier.get(index);
  }
  
  public Map getFirstIdentifier() {
    return this.identifier.get(0);
  }
  
  public Map getLastIdentifier() {
    return this.identifier.get(identifier.size() - 1);
  }
  
  public Map getMatchingIdentifier(Predicate> predicate) {
      for (Map item : identifier) {
        if (predicate.test(item)) {
          return item;
        }
      }
      return null;
  }
  
  public boolean hasMatchingIdentifier(Predicate> predicate) {
      for (Map item : identifier) {
        if (predicate.test(item)) {
          return true;
        }
      }
      return false;
  }
  
  public A withIdentifier(List> identifier) {
    if (identifier != null) {
        this.identifier = new ArrayList();
        for (Map item : identifier) {
          this.addToIdentifier(item);
        }
    } else {
      this.identifier = null;
    }
    return (A) this;
  }
  
  public A withIdentifier(Map... identifier) {
    if (this.identifier != null) {
        this.identifier.clear();
        _visitables.remove("identifier");
    }
    if (identifier != null) {
      for (Map item : identifier) {
        this.addToIdentifier(item);
      }
    }
    return (A) this;
  }
  
  public boolean hasIdentifier() {
    return this.identifier != null && !this.identifier.isEmpty();
  }
  
  public String getRegion() {
    return this.region;
  }
  
  public A withRegion(String region) {
    this.region = region;
    return (A) this;
  }
  
  public boolean hasRegion() {
    return this.region != null;
  }
  
  public A addToServiceEndpoints(int index,ServiceEndpoint item) {
    if (this.serviceEndpoints == null) {this.serviceEndpoints = new ArrayList();}
    ServiceEndpointBuilder builder = new ServiceEndpointBuilder(item);
    if (index < 0 || index >= serviceEndpoints.size()) { _visitables.get("serviceEndpoints").add(builder); serviceEndpoints.add(builder); } else { _visitables.get("serviceEndpoints").add(index, builder); serviceEndpoints.add(index, builder);}
    return (A)this;
  }
  
  public A setToServiceEndpoints(int index,ServiceEndpoint item) {
    if (this.serviceEndpoints == null) {this.serviceEndpoints = new ArrayList();}
    ServiceEndpointBuilder builder = new ServiceEndpointBuilder(item);
    if (index < 0 || index >= serviceEndpoints.size()) { _visitables.get("serviceEndpoints").add(builder); serviceEndpoints.add(builder); } else { _visitables.get("serviceEndpoints").set(index, builder); serviceEndpoints.set(index, builder);}
    return (A)this;
  }
  
  public A addToServiceEndpoints(io.fabric8.openshift.api.model.installer.aws.v1.ServiceEndpoint... items) {
    if (this.serviceEndpoints == null) {this.serviceEndpoints = new ArrayList();}
    for (ServiceEndpoint item : items) {ServiceEndpointBuilder builder = new ServiceEndpointBuilder(item);_visitables.get("serviceEndpoints").add(builder);this.serviceEndpoints.add(builder);} return (A)this;
  }
  
  public A addAllToServiceEndpoints(Collection items) {
    if (this.serviceEndpoints == null) {this.serviceEndpoints = new ArrayList();}
    for (ServiceEndpoint item : items) {ServiceEndpointBuilder builder = new ServiceEndpointBuilder(item);_visitables.get("serviceEndpoints").add(builder);this.serviceEndpoints.add(builder);} return (A)this;
  }
  
  public A removeFromServiceEndpoints(io.fabric8.openshift.api.model.installer.aws.v1.ServiceEndpoint... items) {
    if (this.serviceEndpoints == null) return (A)this;
    for (ServiceEndpoint item : items) {ServiceEndpointBuilder builder = new ServiceEndpointBuilder(item);_visitables.get("serviceEndpoints").remove(builder); this.serviceEndpoints.remove(builder);} return (A)this;
  }
  
  public A removeAllFromServiceEndpoints(Collection items) {
    if (this.serviceEndpoints == null) return (A)this;
    for (ServiceEndpoint item : items) {ServiceEndpointBuilder builder = new ServiceEndpointBuilder(item);_visitables.get("serviceEndpoints").remove(builder); this.serviceEndpoints.remove(builder);} return (A)this;
  }
  
  public A removeMatchingFromServiceEndpoints(Predicate predicate) {
    if (serviceEndpoints == null) return (A) this;
    final Iterator each = serviceEndpoints.iterator();
    final List visitables = _visitables.get("serviceEndpoints");
    while (each.hasNext()) {
      ServiceEndpointBuilder builder = each.next();
      if (predicate.test(builder)) {
        visitables.remove(builder);
        each.remove();
      }
    }
    return (A)this;
  }
  
  public List buildServiceEndpoints() {
    return this.serviceEndpoints != null ? build(serviceEndpoints) : null;
  }
  
  public ServiceEndpoint buildServiceEndpoint(int index) {
    return this.serviceEndpoints.get(index).build();
  }
  
  public ServiceEndpoint buildFirstServiceEndpoint() {
    return this.serviceEndpoints.get(0).build();
  }
  
  public ServiceEndpoint buildLastServiceEndpoint() {
    return this.serviceEndpoints.get(serviceEndpoints.size() - 1).build();
  }
  
  public ServiceEndpoint buildMatchingServiceEndpoint(Predicate predicate) {
      for (ServiceEndpointBuilder item : serviceEndpoints) {
        if (predicate.test(item)) {
          return item.build();
        }
      }
      return null;
  }
  
  public boolean hasMatchingServiceEndpoint(Predicate predicate) {
      for (ServiceEndpointBuilder item : serviceEndpoints) {
        if (predicate.test(item)) {
          return true;
        }
      }
      return false;
  }
  
  public A withServiceEndpoints(List serviceEndpoints) {
    if (this.serviceEndpoints != null) {
      this._visitables.get("serviceEndpoints").clear();
    }
    if (serviceEndpoints != null) {
        this.serviceEndpoints = new ArrayList();
        for (ServiceEndpoint item : serviceEndpoints) {
          this.addToServiceEndpoints(item);
        }
    } else {
      this.serviceEndpoints = null;
    }
    return (A) this;
  }
  
  public A withServiceEndpoints(io.fabric8.openshift.api.model.installer.aws.v1.ServiceEndpoint... serviceEndpoints) {
    if (this.serviceEndpoints != null) {
        this.serviceEndpoints.clear();
        _visitables.remove("serviceEndpoints");
    }
    if (serviceEndpoints != null) {
      for (ServiceEndpoint item : serviceEndpoints) {
        this.addToServiceEndpoints(item);
      }
    }
    return (A) this;
  }
  
  public boolean hasServiceEndpoints() {
    return this.serviceEndpoints != null && !this.serviceEndpoints.isEmpty();
  }
  
  public A addNewServiceEndpoint(String name,String url) {
    return (A)addToServiceEndpoints(new ServiceEndpoint(name, url));
  }
  
  public ServiceEndpointsNested addNewServiceEndpoint() {
    return new ServiceEndpointsNested(-1, null);
  }
  
  public ServiceEndpointsNested addNewServiceEndpointLike(ServiceEndpoint item) {
    return new ServiceEndpointsNested(-1, item);
  }
  
  public ServiceEndpointsNested setNewServiceEndpointLike(int index,ServiceEndpoint item) {
    return new ServiceEndpointsNested(index, item);
  }
  
  public ServiceEndpointsNested editServiceEndpoint(int index) {
    if (serviceEndpoints.size() <= index) throw new RuntimeException("Can't edit serviceEndpoints. Index exceeds size.");
    return setNewServiceEndpointLike(index, buildServiceEndpoint(index));
  }
  
  public ServiceEndpointsNested editFirstServiceEndpoint() {
    if (serviceEndpoints.size() == 0) throw new RuntimeException("Can't edit first serviceEndpoints. The list is empty.");
    return setNewServiceEndpointLike(0, buildServiceEndpoint(0));
  }
  
  public ServiceEndpointsNested editLastServiceEndpoint() {
    int index = serviceEndpoints.size() - 1;
    if (index < 0) throw new RuntimeException("Can't edit last serviceEndpoints. The list is empty.");
    return setNewServiceEndpointLike(index, buildServiceEndpoint(index));
  }
  
  public ServiceEndpointsNested editMatchingServiceEndpoint(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;
    MetadataFluent that = (MetadataFluent) o;
    if (!java.util.Objects.equals(clusterDomain, that.clusterDomain)) return false;
    if (!java.util.Objects.equals(hostedZoneRole, that.hostedZoneRole)) return false;
    if (!java.util.Objects.equals(identifier, that.identifier)) return false;
    if (!java.util.Objects.equals(region, that.region)) return false;
    if (!java.util.Objects.equals(serviceEndpoints, that.serviceEndpoints)) return false;
    if (!java.util.Objects.equals(additionalProperties, that.additionalProperties)) return false;
    return true;
  }
  
  public int hashCode() {
    return java.util.Objects.hash(clusterDomain,  hostedZoneRole,  identifier,  region,  serviceEndpoints,  additionalProperties,  super.hashCode());
  }
  
  public String toString() {
    StringBuilder sb = new StringBuilder();
    sb.append("{");
    if (clusterDomain != null) { sb.append("clusterDomain:"); sb.append(clusterDomain + ","); }
    if (hostedZoneRole != null) { sb.append("hostedZoneRole:"); sb.append(hostedZoneRole + ","); }
    if (identifier != null && !identifier.isEmpty()) { sb.append("identifier:"); sb.append(identifier + ","); }
    if (region != null) { sb.append("region:"); sb.append(region + ","); }
    if (serviceEndpoints != null && !serviceEndpoints.isEmpty()) { sb.append("serviceEndpoints:"); sb.append(serviceEndpoints + ","); }
    if (additionalProperties != null && !additionalProperties.isEmpty()) { sb.append("additionalProperties:"); sb.append(additionalProperties); }
    sb.append("}");
    return sb.toString();
  }
  public class ServiceEndpointsNested extends ServiceEndpointFluent> implements Nested{
    ServiceEndpointsNested(int index,ServiceEndpoint item) {
      this.index = index;
      this.builder = new ServiceEndpointBuilder(this, item);
    }
    ServiceEndpointBuilder builder;
    int index;
    
    public N and() {
      return (N) MetadataFluent.this.setToServiceEndpoints(index,builder.build());
    }
    
    public N endServiceEndpoint() {
      return and();
    }
    
  
  }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy