io.fabric8.openshift.api.model.machine.v1beta1.MachineSpecFluent Maven / Gradle / Ivy
package io.fabric8.openshift.api.model.machine.v1beta1;
import java.lang.SuppressWarnings;
import io.fabric8.kubernetes.api.builder.Nested;
import java.util.ArrayList;
import java.lang.String;
import io.fabric8.kubernetes.api.model.Taint;
import java.util.LinkedHashMap;
import java.util.function.Predicate;
import io.fabric8.kubernetes.api.builder.BaseFluent;
import java.util.List;
import java.util.Collection;
import java.lang.Object;
import java.util.Map;
/**
* Generated
*/
@SuppressWarnings("unchecked")
public class MachineSpecFluent> extends BaseFluent{
public MachineSpecFluent() {
}
public MachineSpecFluent(MachineSpec instance) {
this.copyInstance(instance);
}
private LifecycleHooksBuilder lifecycleHooks;
private ObjectMetaBuilder metadata;
private String providerID;
private ProviderSpecBuilder providerSpec;
private List taints = new ArrayList();
private Map additionalProperties;
protected void copyInstance(MachineSpec instance) {
instance = (instance != null ? instance : new MachineSpec());
if (instance != null) {
this.withLifecycleHooks(instance.getLifecycleHooks());
this.withMetadata(instance.getMetadata());
this.withProviderID(instance.getProviderID());
this.withProviderSpec(instance.getProviderSpec());
this.withTaints(instance.getTaints());
this.withLifecycleHooks(instance.getLifecycleHooks());
this.withMetadata(instance.getMetadata());
this.withProviderID(instance.getProviderID());
this.withProviderSpec(instance.getProviderSpec());
this.withTaints(instance.getTaints());
this.withAdditionalProperties(instance.getAdditionalProperties());
}
}
public LifecycleHooks buildLifecycleHooks() {
return this.lifecycleHooks!=null ?this.lifecycleHooks.build():null;
}
public A withLifecycleHooks(LifecycleHooks lifecycleHooks) {
_visitables.get("lifecycleHooks").remove(this.lifecycleHooks);
if (lifecycleHooks!=null){ this.lifecycleHooks= new LifecycleHooksBuilder(lifecycleHooks); _visitables.get("lifecycleHooks").add(this.lifecycleHooks);} else { this.lifecycleHooks = null; _visitables.get("lifecycleHooks").remove(this.lifecycleHooks); } return (A) this;
}
public boolean hasLifecycleHooks() {
return this.lifecycleHooks != null;
}
public LifecycleHooksNested withNewLifecycleHooks() {
return new LifecycleHooksNested(null);
}
public LifecycleHooksNested withNewLifecycleHooksLike(LifecycleHooks item) {
return new LifecycleHooksNested(item);
}
public LifecycleHooksNested editLifecycleHooks() {
return withNewLifecycleHooksLike(java.util.Optional.ofNullable(buildLifecycleHooks()).orElse(null));
}
public LifecycleHooksNested editOrNewLifecycleHooks() {
return withNewLifecycleHooksLike(java.util.Optional.ofNullable(buildLifecycleHooks()).orElse(new LifecycleHooksBuilder().build()));
}
public LifecycleHooksNested editOrNewLifecycleHooksLike(LifecycleHooks item) {
return withNewLifecycleHooksLike(java.util.Optional.ofNullable(buildLifecycleHooks()).orElse(item));
}
public ObjectMeta buildMetadata() {
return this.metadata!=null ?this.metadata.build():null;
}
public A withMetadata(ObjectMeta metadata) {
_visitables.get("metadata").remove(this.metadata);
if (metadata!=null){ this.metadata= new ObjectMetaBuilder(metadata); _visitables.get("metadata").add(this.metadata);} else { this.metadata = null; _visitables.get("metadata").remove(this.metadata); } return (A) this;
}
public boolean hasMetadata() {
return this.metadata != null;
}
public MetadataNested withNewMetadata() {
return new MetadataNested(null);
}
public MetadataNested withNewMetadataLike(ObjectMeta item) {
return new MetadataNested(item);
}
public MetadataNested editMetadata() {
return withNewMetadataLike(java.util.Optional.ofNullable(buildMetadata()).orElse(null));
}
public MetadataNested editOrNewMetadata() {
return withNewMetadataLike(java.util.Optional.ofNullable(buildMetadata()).orElse(new ObjectMetaBuilder().build()));
}
public MetadataNested editOrNewMetadataLike(ObjectMeta item) {
return withNewMetadataLike(java.util.Optional.ofNullable(buildMetadata()).orElse(item));
}
public String getProviderID() {
return this.providerID;
}
public A withProviderID(String providerID) {
this.providerID=providerID; return (A) this;
}
public boolean hasProviderID() {
return this.providerID != null;
}
public ProviderSpec buildProviderSpec() {
return this.providerSpec!=null ?this.providerSpec.build():null;
}
public A withProviderSpec(ProviderSpec providerSpec) {
_visitables.get("providerSpec").remove(this.providerSpec);
if (providerSpec!=null){ this.providerSpec= new ProviderSpecBuilder(providerSpec); _visitables.get("providerSpec").add(this.providerSpec);} else { this.providerSpec = null; _visitables.get("providerSpec").remove(this.providerSpec); } return (A) this;
}
public boolean hasProviderSpec() {
return this.providerSpec != null;
}
public ProviderSpecNested withNewProviderSpec() {
return new ProviderSpecNested(null);
}
public ProviderSpecNested withNewProviderSpecLike(ProviderSpec item) {
return new ProviderSpecNested(item);
}
public ProviderSpecNested editProviderSpec() {
return withNewProviderSpecLike(java.util.Optional.ofNullable(buildProviderSpec()).orElse(null));
}
public ProviderSpecNested editOrNewProviderSpec() {
return withNewProviderSpecLike(java.util.Optional.ofNullable(buildProviderSpec()).orElse(new ProviderSpecBuilder().build()));
}
public ProviderSpecNested editOrNewProviderSpecLike(ProviderSpec item) {
return withNewProviderSpecLike(java.util.Optional.ofNullable(buildProviderSpec()).orElse(item));
}
public A addToTaints(int index,Taint item) {
if (this.taints == null) {this.taints = new ArrayList();}
this.taints.add(index, item);
return (A)this;
}
public A setToTaints(int index,Taint item) {
if (this.taints == null) {this.taints = new ArrayList();}
this.taints.set(index, item); return (A)this;
}
public A addToTaints(io.fabric8.kubernetes.api.model.Taint... items) {
if (this.taints == null) {this.taints = new ArrayList();}
for (Taint item : items) {this.taints.add(item);} return (A)this;
}
public A addAllToTaints(Collection items) {
if (this.taints == null) {this.taints = new ArrayList();}
for (Taint item : items) {this.taints.add(item);} return (A)this;
}
public A removeFromTaints(io.fabric8.kubernetes.api.model.Taint... items) {
if (this.taints == null) return (A)this;
for (Taint item : items) { this.taints.remove(item);} return (A)this;
}
public A removeAllFromTaints(Collection items) {
if (this.taints == null) return (A)this;
for (Taint item : items) { this.taints.remove(item);} return (A)this;
}
public List getTaints() {
return this.taints;
}
public Taint getTaint(int index) {
return this.taints.get(index);
}
public Taint getFirstTaint() {
return this.taints.get(0);
}
public Taint getLastTaint() {
return this.taints.get(taints.size() - 1);
}
public Taint getMatchingTaint(Predicate predicate) {
for (Taint item: taints) { if(predicate.test(item)){ return item;} } return null;
}
public boolean hasMatchingTaint(Predicate predicate) {
for (Taint item: taints) { if(predicate.test(item)){ return true;} } return false;
}
public A withTaints(List taints) {
if (taints != null) {this.taints = new ArrayList(); for (Taint item : taints){this.addToTaints(item);}} else { this.taints = null;} return (A) this;
}
public A withTaints(io.fabric8.kubernetes.api.model.Taint... taints) {
if (this.taints != null) {this.taints.clear(); _visitables.remove("taints"); }
if (taints != null) {for (Taint item :taints){ this.addToTaints(item);}} return (A) this;
}
public boolean hasTaints() {
return taints != null && !taints.isEmpty();
}
public A addNewTaint(String effect,String key,String timeAdded,String value) {
return (A)addToTaints(new Taint(effect, key, timeAdded, value));
}
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;
MachineSpecFluent that = (MachineSpecFluent) o;
if (!java.util.Objects.equals(lifecycleHooks, that.lifecycleHooks)) return false;
if (!java.util.Objects.equals(metadata, that.metadata)) return false;
if (!java.util.Objects.equals(providerID, that.providerID)) return false;
if (!java.util.Objects.equals(providerSpec, that.providerSpec)) return false;
if (!java.util.Objects.equals(taints, that.taints)) return false;
if (!java.util.Objects.equals(additionalProperties, that.additionalProperties)) return false;
return true;
}
public int hashCode() {
return java.util.Objects.hash(lifecycleHooks, metadata, providerID, providerSpec, taints, additionalProperties, super.hashCode());
}
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
if (lifecycleHooks != null) { sb.append("lifecycleHooks:"); sb.append(lifecycleHooks + ","); }
if (metadata != null) { sb.append("metadata:"); sb.append(metadata + ","); }
if (providerID != null) { sb.append("providerID:"); sb.append(providerID + ","); }
if (providerSpec != null) { sb.append("providerSpec:"); sb.append(providerSpec + ","); }
if (taints != null && !taints.isEmpty()) { sb.append("taints:"); sb.append(taints + ","); }
if (additionalProperties != null && !additionalProperties.isEmpty()) { sb.append("additionalProperties:"); sb.append(additionalProperties); }
sb.append("}");
return sb.toString();
}
public class LifecycleHooksNested extends LifecycleHooksFluent> implements Nested{
LifecycleHooksNested(LifecycleHooks item) {
this.builder = new LifecycleHooksBuilder(this, item);
}
LifecycleHooksBuilder builder;
public N and() {
return (N) MachineSpecFluent.this.withLifecycleHooks(builder.build());
}
public N endLifecycleHooks() {
return and();
}
}
public class MetadataNested extends ObjectMetaFluent> implements Nested{
MetadataNested(ObjectMeta item) {
this.builder = new ObjectMetaBuilder(this, item);
}
ObjectMetaBuilder builder;
public N and() {
return (N) MachineSpecFluent.this.withMetadata(builder.build());
}
public N endMetadata() {
return and();
}
}
public class ProviderSpecNested extends ProviderSpecFluent> implements Nested{
ProviderSpecNested(ProviderSpec item) {
this.builder = new ProviderSpecBuilder(this, item);
}
ProviderSpecBuilder builder;
public N and() {
return (N) MachineSpecFluent.this.withProviderSpec(builder.build());
}
public N endProviderSpec() {
return and();
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy