io.fabric8.kubernetes.api.model.discovery.v1.EndpointFluent Maven / Gradle / Ivy
The newest version!
package io.fabric8.kubernetes.api.model.discovery.v1;
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.List;
import java.lang.Boolean;
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 EndpointFluent> extends BaseFluent{
public EndpointFluent() {
}
public EndpointFluent(Endpoint instance) {
this.copyInstance(instance);
}
private List addresses = new ArrayList();
private EndpointConditionsBuilder conditions;
private Map deprecatedTopology;
private EndpointHintsBuilder hints;
private String hostname;
private String nodeName;
private ObjectReferenceBuilder targetRef;
private String zone;
private Map additionalProperties;
protected void copyInstance(Endpoint instance) {
instance = (instance != null ? instance : new Endpoint());
if (instance != null) {
this.withAddresses(instance.getAddresses());
this.withConditions(instance.getConditions());
this.withDeprecatedTopology(instance.getDeprecatedTopology());
this.withHints(instance.getHints());
this.withHostname(instance.getHostname());
this.withNodeName(instance.getNodeName());
this.withTargetRef(instance.getTargetRef());
this.withZone(instance.getZone());
this.withAdditionalProperties(instance.getAdditionalProperties());
}
}
public A addToAddresses(int index,String item) {
if (this.addresses == null) {this.addresses = new ArrayList();}
this.addresses.add(index, item);
return (A)this;
}
public A setToAddresses(int index,String item) {
if (this.addresses == null) {this.addresses = new ArrayList();}
this.addresses.set(index, item); return (A)this;
}
public A addToAddresses(java.lang.String... items) {
if (this.addresses == null) {this.addresses = new ArrayList();}
for (String item : items) {this.addresses.add(item);} return (A)this;
}
public A addAllToAddresses(Collection items) {
if (this.addresses == null) {this.addresses = new ArrayList();}
for (String item : items) {this.addresses.add(item);} return (A)this;
}
public A removeFromAddresses(java.lang.String... items) {
if (this.addresses == null) return (A)this;
for (String item : items) { this.addresses.remove(item);} return (A)this;
}
public A removeAllFromAddresses(Collection items) {
if (this.addresses == null) return (A)this;
for (String item : items) { this.addresses.remove(item);} return (A)this;
}
public List getAddresses() {
return this.addresses;
}
public String getAddress(int index) {
return this.addresses.get(index);
}
public String getFirstAddress() {
return this.addresses.get(0);
}
public String getLastAddress() {
return this.addresses.get(addresses.size() - 1);
}
public String getMatchingAddress(Predicate predicate) {
for (String item : addresses) {
if (predicate.test(item)) {
return item;
}
}
return null;
}
public boolean hasMatchingAddress(Predicate predicate) {
for (String item : addresses) {
if (predicate.test(item)) {
return true;
}
}
return false;
}
public A withAddresses(List addresses) {
if (addresses != null) {
this.addresses = new ArrayList();
for (String item : addresses) {
this.addToAddresses(item);
}
} else {
this.addresses = null;
}
return (A) this;
}
public A withAddresses(java.lang.String... addresses) {
if (this.addresses != null) {
this.addresses.clear();
_visitables.remove("addresses");
}
if (addresses != null) {
for (String item : addresses) {
this.addToAddresses(item);
}
}
return (A) this;
}
public boolean hasAddresses() {
return this.addresses != null && !this.addresses.isEmpty();
}
public EndpointConditions buildConditions() {
return this.conditions != null ? this.conditions.build() : null;
}
public A withConditions(EndpointConditions conditions) {
this._visitables.remove("conditions");
if (conditions != null) {
this.conditions = new EndpointConditionsBuilder(conditions);
this._visitables.get("conditions").add(this.conditions);
} else {
this.conditions = null;
this._visitables.get("conditions").remove(this.conditions);
}
return (A) this;
}
public boolean hasConditions() {
return this.conditions != null;
}
public A withNewConditions(Boolean ready,Boolean serving,Boolean terminating) {
return (A)withConditions(new EndpointConditions(ready, serving, terminating));
}
public ConditionsNested withNewConditions() {
return new ConditionsNested(null);
}
public ConditionsNested withNewConditionsLike(EndpointConditions item) {
return new ConditionsNested(item);
}
public ConditionsNested editConditions() {
return withNewConditionsLike(java.util.Optional.ofNullable(buildConditions()).orElse(null));
}
public ConditionsNested editOrNewConditions() {
return withNewConditionsLike(java.util.Optional.ofNullable(buildConditions()).orElse(new EndpointConditionsBuilder().build()));
}
public ConditionsNested editOrNewConditionsLike(EndpointConditions item) {
return withNewConditionsLike(java.util.Optional.ofNullable(buildConditions()).orElse(item));
}
public A addToDeprecatedTopology(String key,String value) {
if(this.deprecatedTopology == null && key != null && value != null) { this.deprecatedTopology = new LinkedHashMap(); }
if(key != null && value != null) {this.deprecatedTopology.put(key, value);} return (A)this;
}
public A addToDeprecatedTopology(Map map) {
if(this.deprecatedTopology == null && map != null) { this.deprecatedTopology = new LinkedHashMap(); }
if(map != null) { this.deprecatedTopology.putAll(map);} return (A)this;
}
public A removeFromDeprecatedTopology(String key) {
if(this.deprecatedTopology == null) { return (A) this; }
if(key != null && this.deprecatedTopology != null) {this.deprecatedTopology.remove(key);} return (A)this;
}
public A removeFromDeprecatedTopology(Map map) {
if(this.deprecatedTopology == null) { return (A) this; }
if(map != null) { for(Object key : map.keySet()) {if (this.deprecatedTopology != null){this.deprecatedTopology.remove(key);}}} return (A)this;
}
public Map getDeprecatedTopology() {
return this.deprecatedTopology;
}
public A withDeprecatedTopology(Map deprecatedTopology) {
if (deprecatedTopology == null) {
this.deprecatedTopology = null;
} else {
this.deprecatedTopology = new LinkedHashMap(deprecatedTopology);
}
return (A) this;
}
public boolean hasDeprecatedTopology() {
return this.deprecatedTopology != null;
}
public EndpointHints buildHints() {
return this.hints != null ? this.hints.build() : null;
}
public A withHints(EndpointHints hints) {
this._visitables.remove("hints");
if (hints != null) {
this.hints = new EndpointHintsBuilder(hints);
this._visitables.get("hints").add(this.hints);
} else {
this.hints = null;
this._visitables.get("hints").remove(this.hints);
}
return (A) this;
}
public boolean hasHints() {
return this.hints != null;
}
public HintsNested withNewHints() {
return new HintsNested(null);
}
public HintsNested withNewHintsLike(EndpointHints item) {
return new HintsNested(item);
}
public HintsNested editHints() {
return withNewHintsLike(java.util.Optional.ofNullable(buildHints()).orElse(null));
}
public HintsNested editOrNewHints() {
return withNewHintsLike(java.util.Optional.ofNullable(buildHints()).orElse(new EndpointHintsBuilder().build()));
}
public HintsNested editOrNewHintsLike(EndpointHints item) {
return withNewHintsLike(java.util.Optional.ofNullable(buildHints()).orElse(item));
}
public String getHostname() {
return this.hostname;
}
public A withHostname(String hostname) {
this.hostname = hostname;
return (A) this;
}
public boolean hasHostname() {
return this.hostname != null;
}
public String getNodeName() {
return this.nodeName;
}
public A withNodeName(String nodeName) {
this.nodeName = nodeName;
return (A) this;
}
public boolean hasNodeName() {
return this.nodeName != null;
}
public ObjectReference buildTargetRef() {
return this.targetRef != null ? this.targetRef.build() : null;
}
public A withTargetRef(ObjectReference targetRef) {
this._visitables.remove("targetRef");
if (targetRef != null) {
this.targetRef = new ObjectReferenceBuilder(targetRef);
this._visitables.get("targetRef").add(this.targetRef);
} else {
this.targetRef = null;
this._visitables.get("targetRef").remove(this.targetRef);
}
return (A) this;
}
public boolean hasTargetRef() {
return this.targetRef != null;
}
public TargetRefNested withNewTargetRef() {
return new TargetRefNested(null);
}
public TargetRefNested withNewTargetRefLike(ObjectReference item) {
return new TargetRefNested(item);
}
public TargetRefNested editTargetRef() {
return withNewTargetRefLike(java.util.Optional.ofNullable(buildTargetRef()).orElse(null));
}
public TargetRefNested editOrNewTargetRef() {
return withNewTargetRefLike(java.util.Optional.ofNullable(buildTargetRef()).orElse(new ObjectReferenceBuilder().build()));
}
public TargetRefNested editOrNewTargetRefLike(ObjectReference item) {
return withNewTargetRefLike(java.util.Optional.ofNullable(buildTargetRef()).orElse(item));
}
public String getZone() {
return this.zone;
}
public A withZone(String zone) {
this.zone = zone;
return (A) this;
}
public boolean hasZone() {
return this.zone != 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;
EndpointFluent that = (EndpointFluent) 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(deprecatedTopology, that.deprecatedTopology)) return false;
if (!java.util.Objects.equals(hints, that.hints)) return false;
if (!java.util.Objects.equals(hostname, that.hostname)) return false;
if (!java.util.Objects.equals(nodeName, that.nodeName)) return false;
if (!java.util.Objects.equals(targetRef, that.targetRef)) return false;
if (!java.util.Objects.equals(zone, that.zone)) return false;
if (!java.util.Objects.equals(additionalProperties, that.additionalProperties)) return false;
return true;
}
public int hashCode() {
return java.util.Objects.hash(addresses, conditions, deprecatedTopology, hints, hostname, nodeName, targetRef, zone, 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) { sb.append("conditions:"); sb.append(conditions + ","); }
if (deprecatedTopology != null && !deprecatedTopology.isEmpty()) { sb.append("deprecatedTopology:"); sb.append(deprecatedTopology + ","); }
if (hints != null) { sb.append("hints:"); sb.append(hints + ","); }
if (hostname != null) { sb.append("hostname:"); sb.append(hostname + ","); }
if (nodeName != null) { sb.append("nodeName:"); sb.append(nodeName + ","); }
if (targetRef != null) { sb.append("targetRef:"); sb.append(targetRef + ","); }
if (zone != null) { sb.append("zone:"); sb.append(zone + ","); }
if (additionalProperties != null && !additionalProperties.isEmpty()) { sb.append("additionalProperties:"); sb.append(additionalProperties); }
sb.append("}");
return sb.toString();
}
public class ConditionsNested extends EndpointConditionsFluent> implements Nested{
ConditionsNested(EndpointConditions item) {
this.builder = new EndpointConditionsBuilder(this, item);
}
EndpointConditionsBuilder builder;
public N and() {
return (N) EndpointFluent.this.withConditions(builder.build());
}
public N endConditions() {
return and();
}
}
public class HintsNested extends EndpointHintsFluent> implements Nested{
HintsNested(EndpointHints item) {
this.builder = new EndpointHintsBuilder(this, item);
}
EndpointHintsBuilder builder;
public N and() {
return (N) EndpointFluent.this.withHints(builder.build());
}
public N endHints() {
return and();
}
}
public class TargetRefNested extends ObjectReferenceFluent> implements Nested{
TargetRefNested(ObjectReference item) {
this.builder = new ObjectReferenceBuilder(this, item);
}
ObjectReferenceBuilder builder;
public N and() {
return (N) EndpointFluent.this.withTargetRef(builder.build());
}
public N endTargetRef() {
return and();
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy