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

io.fabric8.certmanager.api.model.acme.v1.OrderStatusFluent Maven / Gradle / Ivy

package io.fabric8.certmanager.api.model.acme.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 OrderStatusFluent> extends BaseFluent{
  public OrderStatusFluent() {
  }
  
  public OrderStatusFluent(OrderStatus instance) {
    this.copyInstance(instance);
  }
  private ArrayList authorizations = new ArrayList();
  private String certificate;
  private String failureTime;
  private String finalizeURL;
  private String reason;
  private String state;
  private String url;
  private Map additionalProperties;
  
  protected void copyInstance(OrderStatus instance) {
    instance = (instance != null ? instance : new OrderStatus());
    if (instance != null) {
          this.withAuthorizations(instance.getAuthorizations());
          this.withCertificate(instance.getCertificate());
          this.withFailureTime(instance.getFailureTime());
          this.withFinalizeURL(instance.getFinalizeURL());
          this.withReason(instance.getReason());
          this.withState(instance.getState());
          this.withUrl(instance.getUrl());
          this.withAdditionalProperties(instance.getAdditionalProperties());
        }
  }
  
  public A addToAuthorizations(int index,ACMEAuthorization item) {
    if (this.authorizations == null) {this.authorizations = new ArrayList();}
    ACMEAuthorizationBuilder builder = new ACMEAuthorizationBuilder(item);
    if (index < 0 || index >= authorizations.size()) { _visitables.get("authorizations").add(builder); authorizations.add(builder); } else { _visitables.get("authorizations").add(index, builder); authorizations.add(index, builder);}
    return (A)this;
  }
  
  public A setToAuthorizations(int index,ACMEAuthorization item) {
    if (this.authorizations == null) {this.authorizations = new ArrayList();}
    ACMEAuthorizationBuilder builder = new ACMEAuthorizationBuilder(item);
    if (index < 0 || index >= authorizations.size()) { _visitables.get("authorizations").add(builder); authorizations.add(builder); } else { _visitables.get("authorizations").set(index, builder); authorizations.set(index, builder);}
    return (A)this;
  }
  
  public A addToAuthorizations(io.fabric8.certmanager.api.model.acme.v1.ACMEAuthorization... items) {
    if (this.authorizations == null) {this.authorizations = new ArrayList();}
    for (ACMEAuthorization item : items) {ACMEAuthorizationBuilder builder = new ACMEAuthorizationBuilder(item);_visitables.get("authorizations").add(builder);this.authorizations.add(builder);} return (A)this;
  }
  
  public A addAllToAuthorizations(Collection items) {
    if (this.authorizations == null) {this.authorizations = new ArrayList();}
    for (ACMEAuthorization item : items) {ACMEAuthorizationBuilder builder = new ACMEAuthorizationBuilder(item);_visitables.get("authorizations").add(builder);this.authorizations.add(builder);} return (A)this;
  }
  
  public A removeFromAuthorizations(io.fabric8.certmanager.api.model.acme.v1.ACMEAuthorization... items) {
    if (this.authorizations == null) return (A)this;
    for (ACMEAuthorization item : items) {ACMEAuthorizationBuilder builder = new ACMEAuthorizationBuilder(item);_visitables.get("authorizations").remove(builder); this.authorizations.remove(builder);} return (A)this;
  }
  
  public A removeAllFromAuthorizations(Collection items) {
    if (this.authorizations == null) return (A)this;
    for (ACMEAuthorization item : items) {ACMEAuthorizationBuilder builder = new ACMEAuthorizationBuilder(item);_visitables.get("authorizations").remove(builder); this.authorizations.remove(builder);} return (A)this;
  }
  
  public A removeMatchingFromAuthorizations(Predicate predicate) {
    if (authorizations == null) return (A) this;
    final Iterator each = authorizations.iterator();
    final List visitables = _visitables.get("authorizations");
    while (each.hasNext()) {
      ACMEAuthorizationBuilder builder = each.next();
      if (predicate.test(builder)) {
        visitables.remove(builder);
        each.remove();
      }
    }
    return (A)this;
  }
  
  public List buildAuthorizations() {
    return this.authorizations != null ? build(authorizations) : null;
  }
  
  public ACMEAuthorization buildAuthorization(int index) {
    return this.authorizations.get(index).build();
  }
  
  public ACMEAuthorization buildFirstAuthorization() {
    return this.authorizations.get(0).build();
  }
  
  public ACMEAuthorization buildLastAuthorization() {
    return this.authorizations.get(authorizations.size() - 1).build();
  }
  
  public ACMEAuthorization buildMatchingAuthorization(Predicate predicate) {
      for (ACMEAuthorizationBuilder item : authorizations) {
        if (predicate.test(item)) {
          return item.build();
        }
      }
      return null;
  }
  
  public boolean hasMatchingAuthorization(Predicate predicate) {
      for (ACMEAuthorizationBuilder item : authorizations) {
        if (predicate.test(item)) {
          return true;
        }
      }
      return false;
  }
  
  public A withAuthorizations(List authorizations) {
    if (this.authorizations != null) {
      this._visitables.get("authorizations").clear();
    }
    if (authorizations != null) {
        this.authorizations = new ArrayList();
        for (ACMEAuthorization item : authorizations) {
          this.addToAuthorizations(item);
        }
    } else {
      this.authorizations = null;
    }
    return (A) this;
  }
  
  public A withAuthorizations(io.fabric8.certmanager.api.model.acme.v1.ACMEAuthorization... authorizations) {
    if (this.authorizations != null) {
        this.authorizations.clear();
        _visitables.remove("authorizations");
    }
    if (authorizations != null) {
      for (ACMEAuthorization item : authorizations) {
        this.addToAuthorizations(item);
      }
    }
    return (A) this;
  }
  
  public boolean hasAuthorizations() {
    return this.authorizations != null && !this.authorizations.isEmpty();
  }
  
  public AuthorizationsNested addNewAuthorization() {
    return new AuthorizationsNested(-1, null);
  }
  
  public AuthorizationsNested addNewAuthorizationLike(ACMEAuthorization item) {
    return new AuthorizationsNested(-1, item);
  }
  
  public AuthorizationsNested setNewAuthorizationLike(int index,ACMEAuthorization item) {
    return new AuthorizationsNested(index, item);
  }
  
  public AuthorizationsNested editAuthorization(int index) {
    if (authorizations.size() <= index) throw new RuntimeException("Can't edit authorizations. Index exceeds size.");
    return setNewAuthorizationLike(index, buildAuthorization(index));
  }
  
  public AuthorizationsNested editFirstAuthorization() {
    if (authorizations.size() == 0) throw new RuntimeException("Can't edit first authorizations. The list is empty.");
    return setNewAuthorizationLike(0, buildAuthorization(0));
  }
  
  public AuthorizationsNested editLastAuthorization() {
    int index = authorizations.size() - 1;
    if (index < 0) throw new RuntimeException("Can't edit last authorizations. The list is empty.");
    return setNewAuthorizationLike(index, buildAuthorization(index));
  }
  
  public AuthorizationsNested editMatchingAuthorization(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;
    OrderStatusFluent that = (OrderStatusFluent) o;
    if (!java.util.Objects.equals(authorizations, that.authorizations)) return false;
    if (!java.util.Objects.equals(certificate, that.certificate)) return false;
    if (!java.util.Objects.equals(failureTime, that.failureTime)) return false;
    if (!java.util.Objects.equals(finalizeURL, that.finalizeURL)) return false;
    if (!java.util.Objects.equals(reason, that.reason)) return false;
    if (!java.util.Objects.equals(state, that.state)) return false;
    if (!java.util.Objects.equals(url, that.url)) return false;
    if (!java.util.Objects.equals(additionalProperties, that.additionalProperties)) return false;
    return true;
  }
  
  public int hashCode() {
    return java.util.Objects.hash(authorizations,  certificate,  failureTime,  finalizeURL,  reason,  state,  url,  additionalProperties,  super.hashCode());
  }
  
  public String toString() {
    StringBuilder sb = new StringBuilder();
    sb.append("{");
    if (authorizations != null && !authorizations.isEmpty()) { sb.append("authorizations:"); sb.append(authorizations + ","); }
    if (certificate != null) { sb.append("certificate:"); sb.append(certificate + ","); }
    if (failureTime != null) { sb.append("failureTime:"); sb.append(failureTime + ","); }
    if (finalizeURL != null) { sb.append("finalizeURL:"); sb.append(finalizeURL + ","); }
    if (reason != null) { sb.append("reason:"); sb.append(reason + ","); }
    if (state != null) { sb.append("state:"); sb.append(state + ","); }
    if (url != null) { sb.append("url:"); sb.append(url + ","); }
    if (additionalProperties != null && !additionalProperties.isEmpty()) { sb.append("additionalProperties:"); sb.append(additionalProperties); }
    sb.append("}");
    return sb.toString();
  }
  public class AuthorizationsNested extends ACMEAuthorizationFluent> implements Nested{
    AuthorizationsNested(int index,ACMEAuthorization item) {
      this.index = index;
      this.builder = new ACMEAuthorizationBuilder(this, item);
    }
    ACMEAuthorizationBuilder builder;
    int index;
    
    public N and() {
      return (N) OrderStatusFluent.this.setToAuthorizations(index,builder.build());
    }
    
    public N endAuthorization() {
      return and();
    }
    
  
  }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy