io.fabric8.openshift.api.model.miscellaneous.metal3.v1beta1.Metal3RemediationTemplateResourceFluent Maven / Gradle / Ivy
package io.fabric8.openshift.api.model.miscellaneous.metal3.v1beta1;
import java.lang.SuppressWarnings;
import io.fabric8.kubernetes.api.builder.Nested;
import java.lang.String;
import java.util.LinkedHashMap;
import io.fabric8.kubernetes.api.builder.BaseFluent;
import java.lang.Object;
import java.util.Map;
/**
* Generated
*/
@SuppressWarnings("unchecked")
public class Metal3RemediationTemplateResourceFluent> extends BaseFluent{
public Metal3RemediationTemplateResourceFluent() {
}
public Metal3RemediationTemplateResourceFluent(Metal3RemediationTemplateResource instance) {
this.copyInstance(instance);
}
private Metal3RemediationSpecBuilder spec;
private Map additionalProperties;
protected void copyInstance(Metal3RemediationTemplateResource instance) {
instance = (instance != null ? instance : new Metal3RemediationTemplateResource());
if (instance != null) {
this.withSpec(instance.getSpec());
this.withAdditionalProperties(instance.getAdditionalProperties());
}
}
public Metal3RemediationSpec buildSpec() {
return this.spec != null ? this.spec.build() : null;
}
public A withSpec(Metal3RemediationSpec spec) {
this._visitables.remove("spec");
if (spec != null) {
this.spec = new Metal3RemediationSpecBuilder(spec);
this._visitables.get("spec").add(this.spec);
} else {
this.spec = null;
this._visitables.get("spec").remove(this.spec);
}
return (A) this;
}
public boolean hasSpec() {
return this.spec != null;
}
public SpecNested withNewSpec() {
return new SpecNested(null);
}
public SpecNested withNewSpecLike(Metal3RemediationSpec item) {
return new SpecNested(item);
}
public SpecNested editSpec() {
return withNewSpecLike(java.util.Optional.ofNullable(buildSpec()).orElse(null));
}
public SpecNested editOrNewSpec() {
return withNewSpecLike(java.util.Optional.ofNullable(buildSpec()).orElse(new Metal3RemediationSpecBuilder().build()));
}
public SpecNested editOrNewSpecLike(Metal3RemediationSpec item) {
return withNewSpecLike(java.util.Optional.ofNullable(buildSpec()).orElse(item));
}
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;
Metal3RemediationTemplateResourceFluent that = (Metal3RemediationTemplateResourceFluent) o;
if (!java.util.Objects.equals(spec, that.spec)) return false;
if (!java.util.Objects.equals(additionalProperties, that.additionalProperties)) return false;
return true;
}
public int hashCode() {
return java.util.Objects.hash(spec, additionalProperties, super.hashCode());
}
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
if (spec != null) { sb.append("spec:"); sb.append(spec + ","); }
if (additionalProperties != null && !additionalProperties.isEmpty()) { sb.append("additionalProperties:"); sb.append(additionalProperties); }
sb.append("}");
return sb.toString();
}
public class SpecNested extends Metal3RemediationSpecFluent> implements Nested{
SpecNested(Metal3RemediationSpec item) {
this.builder = new Metal3RemediationSpecBuilder(this, item);
}
Metal3RemediationSpecBuilder builder;
public N and() {
return (N) Metal3RemediationTemplateResourceFluent.this.withSpec(builder.build());
}
public N endSpec() {
return and();
}
}
}