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

io.kubernetes.client.openapi.models.V1beta1UserInfoFluentImpl Maven / Gradle / Ivy

There is a newer version: 22.0.0
Show newest version
package io.kubernetes.client.openapi.models;

import java.lang.StringBuilder;
import com.google.gson.annotations.SerializedName;
import java.util.ArrayList;
import java.lang.String;
import io.kubernetes.client.fluent.Predicate;
import java.util.LinkedHashMap;
import java.lang.StringBuffer;
import io.kubernetes.client.fluent.BaseFluent;
import java.util.Collection;
import java.lang.Object;
import java.util.List;
import java.lang.Boolean;
import java.util.Map;

public class V1beta1UserInfoFluentImpl> extends io.kubernetes.client.fluent.BaseFluent implements V1beta1UserInfoFluent {

    private Map> extra;
    private List groups;
    private String uid;
    private String username;

    public V1beta1UserInfoFluentImpl() { 
    }


    public V1beta1UserInfoFluentImpl(V1beta1UserInfo instance) { 
        this.withExtra(instance.getExtra());

        this.withGroups(instance.getGroups());

        this.withUid(instance.getUid());

        this.withUsername(instance.getUsername());

    }


    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(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(String... items) {
        for (String item : items) {if (this.groups!= null){ this.groups.remove(item);}} return (A)this;
    }

    public A removeAllFromGroups(Collection items) {
        for (String item : items) {if (this.groups!= null){ 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(io.kubernetes.client.fluent.Predicate predicate) {
        for (String item: groups) { if(predicate.apply(item)){ return item;} } return null;
    }

    public Boolean hasMatchingGroup(io.kubernetes.client.fluent.Predicate predicate) {
        for (String item: groups) { if(predicate.apply(item)){ return true;} } return false;
    }

    public A withGroups(List groups) {
        if (this.groups != null) { _visitables.get("groups").removeAll(this.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(String... groups) {
        if (this.groups != null) {this.groups.clear();}
        if (groups != null) {for (String item :groups){ this.addToGroups(item);}} return (A) this;
    }

    public Boolean hasGroups() {
        return groups != null && !groups.isEmpty();
    }

    public A addNewGroup(String arg1) {
        return (A)addToGroups(new String(arg1));
    }

    public A addNewGroup(StringBuilder arg1) {
        return (A)addToGroups(new String(arg1));
    }

    public A addNewGroup(StringBuffer arg1) {
        return (A)addToGroups(new String(arg1));
    }

    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 A withNewUid(String arg1) {
        return (A)withUid(new String(arg1));
    }

    public A withNewUid(StringBuilder arg1) {
        return (A)withUid(new String(arg1));
    }

    public A withNewUid(StringBuffer arg1) {
        return (A)withUid(new String(arg1));
    }

    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 withNewUsername(String arg1) {
        return (A)withUsername(new String(arg1));
    }

    public A withNewUsername(StringBuilder arg1) {
        return (A)withUsername(new String(arg1));
    }

    public A withNewUsername(StringBuffer arg1) {
        return (A)withUsername(new String(arg1));
    }

    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        V1beta1UserInfoFluentImpl that = (V1beta1UserInfoFluentImpl) o;
        if (extra != null ? !extra.equals(that.extra) :that.extra != null) return false;
        if (groups != null ? !groups.equals(that.groups) :that.groups != null) return false;
        if (uid != null ? !uid.equals(that.uid) :that.uid != null) return false;
        if (username != null ? !username.equals(that.username) :that.username != null) return false;
        return true;
    }

    public int hashCode() {
        return java.util.Objects.hash(extra,  groups,  uid,  username,  super.hashCode());
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy