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

io.fabric8.openshift.api.model.machine.v1beta1.MachineStatusFluent Maven / Gradle / Ivy

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

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.model.ObjectReference;
import io.fabric8.kubernetes.api.builder.BaseFluent;
import java.util.Iterator;
import io.fabric8.kubernetes.api.model.NodeAddress;
import java.util.List;
import io.fabric8.kubernetes.api.model.ObjectReferenceFluent;
import io.fabric8.kubernetes.api.model.ObjectReferenceBuilder;
import java.util.Collection;
import java.lang.Object;
import java.util.Map;

/**
 * Generated
 */
@SuppressWarnings("unchecked")
public class MachineStatusFluent> extends BaseFluent{
  public MachineStatusFluent() {
  }
  
  public MachineStatusFluent(MachineStatus instance) {
    this.copyInstance(instance);
  }
  private List addresses = new ArrayList();
  private ArrayList conditions = new ArrayList();
  private String errorMessage;
  private String errorReason;
  private LastOperationBuilder lastOperation;
  private String lastUpdated;
  private ObjectReferenceBuilder nodeRef;
  private String phase;
  private Map providerStatus;
  private Map additionalProperties;
  
  protected void copyInstance(MachineStatus instance) {
    instance = (instance != null ? instance : new MachineStatus());
  
    if (instance != null) {
        this.withAddresses(instance.getAddresses());
        this.withConditions(instance.getConditions());
        this.withErrorMessage(instance.getErrorMessage());
        this.withErrorReason(instance.getErrorReason());
        this.withLastOperation(instance.getLastOperation());
        this.withLastUpdated(instance.getLastUpdated());
        this.withNodeRef(instance.getNodeRef());
        this.withPhase(instance.getPhase());
        this.withProviderStatus(instance.getProviderStatus());
        this.withAddresses(instance.getAddresses());
        this.withConditions(instance.getConditions());
        this.withErrorMessage(instance.getErrorMessage());
        this.withErrorReason(instance.getErrorReason());
        this.withLastOperation(instance.getLastOperation());
        this.withLastUpdated(instance.getLastUpdated());
        this.withNodeRef(instance.getNodeRef());
        this.withPhase(instance.getPhase());
        this.withProviderStatus(instance.getProviderStatus());
        this.withAdditionalProperties(instance.getAdditionalProperties());
      }
  }
  
  public A addToAddresses(int index,NodeAddress item) {
    if (this.addresses == null) {this.addresses = new ArrayList();}
    this.addresses.add(index, item);
    return (A)this;
  }
  
  public A setToAddresses(int index,NodeAddress item) {
    if (this.addresses == null) {this.addresses = new ArrayList();}
    this.addresses.set(index, item); return (A)this;
  }
  
  public A addToAddresses(io.fabric8.kubernetes.api.model.NodeAddress... items) {
    if (this.addresses == null) {this.addresses = new ArrayList();}
    for (NodeAddress item : items) {this.addresses.add(item);} return (A)this;
  }
  
  public A addAllToAddresses(Collection items) {
    if (this.addresses == null) {this.addresses = new ArrayList();}
    for (NodeAddress item : items) {this.addresses.add(item);} return (A)this;
  }
  
  public A removeFromAddresses(io.fabric8.kubernetes.api.model.NodeAddress... items) {
    if (this.addresses == null) return (A)this;
    for (NodeAddress item : items) { this.addresses.remove(item);} return (A)this;
  }
  
  public A removeAllFromAddresses(Collection items) {
    if (this.addresses == null) return (A)this;
    for (NodeAddress item : items) { this.addresses.remove(item);} return (A)this;
  }
  
  public List getAddresses() {
    return this.addresses;
  }
  
  public NodeAddress getAddress(int index) {
    return this.addresses.get(index);
  }
  
  public NodeAddress getFirstAddress() {
    return this.addresses.get(0);
  }
  
  public NodeAddress getLastAddress() {
    return this.addresses.get(addresses.size() - 1);
  }
  
  public NodeAddress getMatchingAddress(Predicate predicate) {
    for (NodeAddress item: addresses) { if(predicate.test(item)){ return item;} } return null;
  }
  
  public boolean hasMatchingAddress(Predicate predicate) {
    for (NodeAddress item: addresses) { if(predicate.test(item)){ return true;} } return false;
  }
  
  public A withAddresses(List addresses) {
    if (addresses != null) {this.addresses = new ArrayList(); for (NodeAddress item : addresses){this.addToAddresses(item);}} else { this.addresses = null;} return (A) this;
  }
  
  public A withAddresses(io.fabric8.kubernetes.api.model.NodeAddress... addresses) {
    if (this.addresses != null) {this.addresses.clear(); _visitables.remove("addresses"); }
    if (addresses != null) {for (NodeAddress item :addresses){ this.addToAddresses(item);}} return (A) this;
  }
  
  public boolean hasAddresses() {
    return addresses != null && !addresses.isEmpty();
  }
  
  public A addNewAddress(String address,String type) {
    return (A)addToAddresses(new NodeAddress(address, type));
  }
  
  public A addToConditions(int index,Condition item) {
    if (this.conditions == null) {this.conditions = new ArrayList();}
    ConditionBuilder builder = new ConditionBuilder(item);
    if (index < 0 || index >= conditions.size()) { _visitables.get("conditions").add(builder); conditions.add(builder); } else { _visitables.get("conditions").add(index, builder); conditions.add(index, builder);}
    return (A)this;
  }
  
  public A setToConditions(int index,Condition item) {
    if (this.conditions == null) {this.conditions = new ArrayList();}
    ConditionBuilder builder = new ConditionBuilder(item);
    if (index < 0 || index >= conditions.size()) { _visitables.get("conditions").add(builder); conditions.add(builder); } else { _visitables.get("conditions").set(index, builder); conditions.set(index, builder);}
    return (A)this;
  }
  
  public A addToConditions(io.fabric8.openshift.api.model.machine.v1beta1.Condition... items) {
    if (this.conditions == null) {this.conditions = new ArrayList();}
    for (Condition item : items) {ConditionBuilder builder = new ConditionBuilder(item);_visitables.get("conditions").add(builder);this.conditions.add(builder);} return (A)this;
  }
  
  public A addAllToConditions(Collection items) {
    if (this.conditions == null) {this.conditions = new ArrayList();}
    for (Condition item : items) {ConditionBuilder builder = new ConditionBuilder(item);_visitables.get("conditions").add(builder);this.conditions.add(builder);} return (A)this;
  }
  
  public A removeFromConditions(io.fabric8.openshift.api.model.machine.v1beta1.Condition... items) {
    if (this.conditions == null) return (A)this;
    for (Condition item : items) {ConditionBuilder builder = new ConditionBuilder(item);_visitables.get("conditions").remove(builder); this.conditions.remove(builder);} return (A)this;
  }
  
  public A removeAllFromConditions(Collection items) {
    if (this.conditions == null) return (A)this;
    for (Condition item : items) {ConditionBuilder builder = new ConditionBuilder(item);_visitables.get("conditions").remove(builder); this.conditions.remove(builder);} return (A)this;
  }
  
  public A removeMatchingFromConditions(Predicate predicate) {
    if (conditions == null) return (A) this;
    final Iterator each = conditions.iterator();
    final List visitables = _visitables.get("conditions");
    while (each.hasNext()) {
      ConditionBuilder builder = each.next();
      if (predicate.test(builder)) {
        visitables.remove(builder);
        each.remove();
      }
    }
    return (A)this;
  }
  
  public List buildConditions() {
    return conditions != null ? build(conditions) : null;
  }
  
  public Condition buildCondition(int index) {
    return this.conditions.get(index).build();
  }
  
  public Condition buildFirstCondition() {
    return this.conditions.get(0).build();
  }
  
  public Condition buildLastCondition() {
    return this.conditions.get(conditions.size() - 1).build();
  }
  
  public Condition buildMatchingCondition(Predicate predicate) {
    for (ConditionBuilder item: conditions) { if(predicate.test(item)){ return item.build();} } return null;
  }
  
  public boolean hasMatchingCondition(Predicate predicate) {
    for (ConditionBuilder item: conditions) { if(predicate.test(item)){ return true;} } return false;
  }
  
  public A withConditions(List conditions) {
    if (this.conditions != null) { _visitables.get("conditions").clear();}
    if (conditions != null) {this.conditions = new ArrayList(); for (Condition item : conditions){this.addToConditions(item);}} else { this.conditions = null;} return (A) this;
  }
  
  public A withConditions(io.fabric8.openshift.api.model.machine.v1beta1.Condition... conditions) {
    if (this.conditions != null) {this.conditions.clear(); _visitables.remove("conditions"); }
    if (conditions != null) {for (Condition item :conditions){ this.addToConditions(item);}} return (A) this;
  }
  
  public boolean hasConditions() {
    return conditions != null && !conditions.isEmpty();
  }
  
  public ConditionsNested addNewCondition() {
    return new ConditionsNested(-1, null);
  }
  
  public ConditionsNested addNewConditionLike(Condition item) {
    return new ConditionsNested(-1, item);
  }
  
  public ConditionsNested setNewConditionLike(int index,Condition item) {
    return new ConditionsNested(index, item);
  }
  
  public ConditionsNested editCondition(int index) {
    if (conditions.size() <= index) throw new RuntimeException("Can't edit conditions. Index exceeds size.");
    return setNewConditionLike(index, buildCondition(index));
  }
  
  public ConditionsNested editFirstCondition() {
    if (conditions.size() == 0) throw new RuntimeException("Can't edit first conditions. The list is empty.");
    return setNewConditionLike(0, buildCondition(0));
  }
  
  public ConditionsNested editLastCondition() {
    int index = conditions.size() - 1;
    if (index < 0) throw new RuntimeException("Can't edit last conditions. The list is empty.");
    return setNewConditionLike(index, buildCondition(index));
  }
  
  public ConditionsNested editMatchingCondition(Predicate predicate) {
    int index = -1;
    for (int i=0;i withNewLastOperation() {
    return new LastOperationNested(null);
  }
  
  public LastOperationNested withNewLastOperationLike(LastOperation item) {
    return new LastOperationNested(item);
  }
  
  public LastOperationNested editLastOperation() {
    return withNewLastOperationLike(java.util.Optional.ofNullable(buildLastOperation()).orElse(null));
  }
  
  public LastOperationNested editOrNewLastOperation() {
    return withNewLastOperationLike(java.util.Optional.ofNullable(buildLastOperation()).orElse(new LastOperationBuilder().build()));
  }
  
  public LastOperationNested editOrNewLastOperationLike(LastOperation item) {
    return withNewLastOperationLike(java.util.Optional.ofNullable(buildLastOperation()).orElse(item));
  }
  
  public String getLastUpdated() {
    return this.lastUpdated;
  }
  
  public A withLastUpdated(String lastUpdated) {
    this.lastUpdated=lastUpdated; return (A) this;
  }
  
  public boolean hasLastUpdated() {
    return this.lastUpdated != null;
  }
  
  public ObjectReference buildNodeRef() {
    return this.nodeRef!=null ?this.nodeRef.build():null;
  }
  
  public A withNodeRef(ObjectReference nodeRef) {
    _visitables.get("nodeRef").remove(this.nodeRef);
    if (nodeRef!=null){ this.nodeRef= new ObjectReferenceBuilder(nodeRef); _visitables.get("nodeRef").add(this.nodeRef);} else { this.nodeRef = null; _visitables.get("nodeRef").remove(this.nodeRef); } return (A) this;
  }
  
  public boolean hasNodeRef() {
    return this.nodeRef != null;
  }
  
  public NodeRefNested withNewNodeRef() {
    return new NodeRefNested(null);
  }
  
  public NodeRefNested withNewNodeRefLike(ObjectReference item) {
    return new NodeRefNested(item);
  }
  
  public NodeRefNested editNodeRef() {
    return withNewNodeRefLike(java.util.Optional.ofNullable(buildNodeRef()).orElse(null));
  }
  
  public NodeRefNested editOrNewNodeRef() {
    return withNewNodeRefLike(java.util.Optional.ofNullable(buildNodeRef()).orElse(new ObjectReferenceBuilder().build()));
  }
  
  public NodeRefNested editOrNewNodeRefLike(ObjectReference item) {
    return withNewNodeRefLike(java.util.Optional.ofNullable(buildNodeRef()).orElse(item));
  }
  
  public String getPhase() {
    return this.phase;
  }
  
  public A withPhase(String phase) {
    this.phase=phase; return (A) this;
  }
  
  public boolean hasPhase() {
    return this.phase != null;
  }
  
  public A addToProviderStatus(String key,Object value) {
    if(this.providerStatus == null && key != null && value != null) { this.providerStatus = new LinkedHashMap(); }
    if(key != null && value != null) {this.providerStatus.put(key, value);} return (A)this;
  }
  
  public A addToProviderStatus(Map map) {
    if(this.providerStatus == null && map != null) { this.providerStatus = new LinkedHashMap(); }
    if(map != null) { this.providerStatus.putAll(map);} return (A)this;
  }
  
  public A removeFromProviderStatus(String key) {
    if(this.providerStatus == null) { return (A) this; }
    if(key != null && this.providerStatus != null) {this.providerStatus.remove(key);} return (A)this;
  }
  
  public A removeFromProviderStatus(Map map) {
    if(this.providerStatus == null) { return (A) this; }
    if(map != null) { for(Object key : map.keySet()) {if (this.providerStatus != null){this.providerStatus.remove(key);}}} return (A)this;
  }
  
  public Map getProviderStatus() {
    return this.providerStatus;
  }
  
  public A withProviderStatus(Map providerStatus) {
    if (providerStatus == null) { this.providerStatus =  null;} else {this.providerStatus = new LinkedHashMap(providerStatus);} return (A) this;
  }
  
  public boolean hasProviderStatus() {
    return this.providerStatus != null;
  }
  
  public A addToAdditionalProperties(String key,Object value) {
    if(this.additionalProperties == null && key != null && value != null) { this.additionalProperties = new LinkedHashMap(); }
    if(key != null && value != null) {this.additionalProperties.put(key, value);} return (A)this;
  }
  
  public A addToAdditionalProperties(Map 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;
    MachineStatusFluent that = (MachineStatusFluent) o;
    if (!java.util.Objects.equals(addresses, that.addresses)) return false;
  
    if (!java.util.Objects.equals(conditions, that.conditions)) return false;
  
    if (!java.util.Objects.equals(errorMessage, that.errorMessage)) return false;
  
    if (!java.util.Objects.equals(errorReason, that.errorReason)) return false;
  
    if (!java.util.Objects.equals(lastOperation, that.lastOperation)) return false;
  
    if (!java.util.Objects.equals(lastUpdated, that.lastUpdated)) return false;
  
    if (!java.util.Objects.equals(nodeRef, that.nodeRef)) return false;
  
    if (!java.util.Objects.equals(phase, that.phase)) return false;
  
    if (!java.util.Objects.equals(providerStatus, that.providerStatus)) return false;
  
    if (!java.util.Objects.equals(additionalProperties, that.additionalProperties)) return false;
  
    return true;
  }
  
  public int hashCode() {
    return java.util.Objects.hash(addresses,  conditions,  errorMessage,  errorReason,  lastOperation,  lastUpdated,  nodeRef,  phase,  providerStatus,  additionalProperties,  super.hashCode());
  }
  
  public String toString() {
    StringBuilder sb = new StringBuilder();
    sb.append("{");
    if (addresses != null && !addresses.isEmpty()) { sb.append("addresses:"); sb.append(addresses + ","); }
    if (conditions != null && !conditions.isEmpty()) { sb.append("conditions:"); sb.append(conditions + ","); }
    if (errorMessage != null) { sb.append("errorMessage:"); sb.append(errorMessage + ","); }
    if (errorReason != null) { sb.append("errorReason:"); sb.append(errorReason + ","); }
    if (lastOperation != null) { sb.append("lastOperation:"); sb.append(lastOperation + ","); }
    if (lastUpdated != null) { sb.append("lastUpdated:"); sb.append(lastUpdated + ","); }
    if (nodeRef != null) { sb.append("nodeRef:"); sb.append(nodeRef + ","); }
    if (phase != null) { sb.append("phase:"); sb.append(phase + ","); }
    if (providerStatus != null && !providerStatus.isEmpty()) { sb.append("providerStatus:"); sb.append(providerStatus + ","); }
    if (additionalProperties != null && !additionalProperties.isEmpty()) { sb.append("additionalProperties:"); sb.append(additionalProperties); }
    sb.append("}");
    return sb.toString();
  }
  public class ConditionsNested extends ConditionFluent> implements Nested{
    ConditionsNested(int index,Condition item) {
      this.index = index;
      this.builder = new ConditionBuilder(this, item);
    }
    ConditionBuilder builder;
    int index;
    
    public N and() {
      return (N) MachineStatusFluent.this.setToConditions(index,builder.build());
    }
    
    public N endCondition() {
      return and();
    }
    
  
  }
  public class LastOperationNested extends LastOperationFluent> implements Nested{
    LastOperationNested(LastOperation item) {
      this.builder = new LastOperationBuilder(this, item);
    }
    LastOperationBuilder builder;
    
    public N and() {
      return (N) MachineStatusFluent.this.withLastOperation(builder.build());
    }
    
    public N endLastOperation() {
      return and();
    }
    
  
  }
  public class NodeRefNested extends ObjectReferenceFluent> implements Nested{
    NodeRefNested(ObjectReference item) {
      this.builder = new ObjectReferenceBuilder(this, item);
    }
    ObjectReferenceBuilder builder;
    
    public N and() {
      return (N) MachineStatusFluent.this.withNodeRef(builder.build());
    }
    
    public N endNodeRef() {
      return and();
    }
    
  
  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy