
io.fabric8.kubernetes.api.model.authentication.UserInfoFluent Maven / Gradle / Ivy
package io.fabric8.kubernetes.api.model.authentication;
import java.lang.SuppressWarnings;
import io.fabric8.kubernetes.api.builder.BaseFluent;
import java.util.ArrayList;
import java.util.Collection;
import java.lang.Object;
import java.util.List;
import java.lang.String;
import java.util.Map;
import java.util.LinkedHashMap;
import java.util.function.Predicate;
/**
* Generated
*/
@SuppressWarnings("unchecked")
public class UserInfoFluent> extends BaseFluent{
public UserInfoFluent() {
}
public UserInfoFluent(UserInfo instance) {
this.copyInstance(instance);
}
private Map> extra;
private List groups = new ArrayList();
private String uid;
private String username;
private Map additionalProperties;
protected void copyInstance(UserInfo instance) {
instance = (instance != null ? instance : new UserInfo());
if (instance != null) {
this.withExtra(instance.getExtra());
this.withGroups(instance.getGroups());
this.withUid(instance.getUid());
this.withUsername(instance.getUsername());
this.withAdditionalProperties(instance.getAdditionalProperties());
}
}
public A addToExtra(String key,List value) {
if(this.extra == null && key != null && value != null) { this.extra = new LinkedHashMap(); }
if(key != null && value != null) {this.extra.put(key, value);} return (A)this;
}
public A addToExtra(Map> map) {
if(this.extra == null && map != null) { this.extra = new LinkedHashMap(); }
if(map != null) { this.extra.putAll(map);} return (A)this;
}
public A removeFromExtra(String key) {
if(this.extra == null) { return (A) this; }
if(key != null && this.extra != null) {this.extra.remove(key);} return (A)this;
}
public A removeFromExtra(Map> map) {
if(this.extra == null) { return (A) this; }
if(map != null) { for(Object key : map.keySet()) {if (this.extra != null){this.extra.remove(key);}}} return (A)this;
}
public Map> getExtra() {
return this.extra;
}
public A withExtra(Map> extra) {
if (extra == null) {
this.extra = null;
} else {
this.extra = new LinkedHashMap(extra);
}
return (A) this;
}
public boolean hasExtra() {
return this.extra != null;
}
public A addToGroups(int index,String item) {
if (this.groups == null) {this.groups = new ArrayList();}
this.groups.add(index, item);
return (A)this;
}
public A setToGroups(int index,String item) {
if (this.groups == null) {this.groups = new ArrayList();}
this.groups.set(index, item); return (A)this;
}
public A addToGroups(java.lang.String... items) {
if (this.groups == null) {this.groups = new ArrayList();}
for (String item : items) {this.groups.add(item);} return (A)this;
}
public A addAllToGroups(Collection items) {
if (this.groups == null) {this.groups = new ArrayList();}
for (String item : items) {this.groups.add(item);} return (A)this;
}
public A removeFromGroups(java.lang.String... items) {
if (this.groups == null) return (A)this;
for (String item : items) { this.groups.remove(item);} return (A)this;
}
public A removeAllFromGroups(Collection items) {
if (this.groups == null) return (A)this;
for (String item : items) { this.groups.remove(item);} return (A)this;
}
public List getGroups() {
return this.groups;
}
public String getGroup(int index) {
return this.groups.get(index);
}
public String getFirstGroup() {
return this.groups.get(0);
}
public String getLastGroup() {
return this.groups.get(groups.size() - 1);
}
public String getMatchingGroup(Predicate predicate) {
for (String item : groups) {
if (predicate.test(item)) {
return item;
}
}
return null;
}
public boolean hasMatchingGroup(Predicate predicate) {
for (String item : groups) {
if (predicate.test(item)) {
return true;
}
}
return false;
}
public A withGroups(List groups) {
if (groups != null) {
this.groups = new ArrayList();
for (String item : groups) {
this.addToGroups(item);
}
} else {
this.groups = null;
}
return (A) this;
}
public A withGroups(java.lang.String... groups) {
if (this.groups != null) {
this.groups.clear();
_visitables.remove("groups");
}
if (groups != null) {
for (String item : groups) {
this.addToGroups(item);
}
}
return (A) this;
}
public boolean hasGroups() {
return this.groups != null && !this.groups.isEmpty();
}
public String getUid() {
return this.uid;
}
public A withUid(String uid) {
this.uid = uid;
return (A) this;
}
public boolean hasUid() {
return this.uid != null;
}
public String getUsername() {
return this.username;
}
public A withUsername(String username) {
this.username = username;
return (A) this;
}
public boolean hasUsername() {
return this.username != 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;
UserInfoFluent that = (UserInfoFluent) o;
if (!java.util.Objects.equals(extra, that.extra)) return false;
if (!java.util.Objects.equals(groups, that.groups)) return false;
if (!java.util.Objects.equals(uid, that.uid)) return false;
if (!java.util.Objects.equals(username, that.username)) return false;
if (!java.util.Objects.equals(additionalProperties, that.additionalProperties)) return false;
return true;
}
public int hashCode() {
return java.util.Objects.hash(extra, groups, uid, username, additionalProperties, super.hashCode());
}
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
if (extra != null && !extra.isEmpty()) { sb.append("extra:"); sb.append(extra + ","); }
if (groups != null && !groups.isEmpty()) { sb.append("groups:"); sb.append(groups + ","); }
if (uid != null) { sb.append("uid:"); sb.append(uid + ","); }
if (username != null) { sb.append("username:"); sb.append(username + ","); }
if (additionalProperties != null && !additionalProperties.isEmpty()) { sb.append("additionalProperties:"); sb.append(additionalProperties); }
sb.append("}");
return sb.toString();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy