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

io.alauda.kubernetes.api.model.authentication.UserInfoFluentImpl Maven / Gradle / Ivy

There is a newer version: 0.2.12
Show newest version
package io.alauda.kubernetes.api.model.authentication;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonInclude;
import java.util.ArrayList;
import java.lang.String;
import io.alauda.kubernetes.api.builder.Predicate;
import java.util.LinkedHashMap;
import javax.validation.Valid;
import io.alauda.kubernetes.api.builder.BaseFluent;
import java.util.Collection;
import java.lang.Object;
import java.util.List;
import java.lang.Boolean;
import java.util.Map;

public class UserInfoFluentImpl> extends io.alauda.kubernetes.api.builder.BaseFluent implements UserInfoFluent{

    private Map> extra = new LinkedHashMap>();
    private List groups = new ArrayList();
    private String uid;
    private String username;

    public UserInfoFluentImpl(){
    }
    public UserInfoFluentImpl(UserInfo instance){
            this.withExtra(instance.getExtra()); 
            this.withGroups(instance.getGroups()); 
            this.withUid(instance.getUid()); 
            this.withUsername(instance.getUsername()); 
    }

    public A addToExtra(String key,ArrayList value){
            if(key != null && value != null) {this.extra.put(key, value);} return (A)this;
    }

    public A addToExtra(Map> map){
            if(map != null) { this.extra.putAll(map);} return (A)this;
    }

    public A removeFromExtra(String key){
            if(key != null) {this.extra.remove(key);} return (A)this;
    }

    public A removeFromExtra(Map> map){
            if(map != null) { for(Object key : map.keySet()) {this.extra.remove(key);}} return (A)this;
    }

    public Map> getExtra(){
            return this.extra;
    }

    public A withExtra(Map> extra){
            this.extra.clear();
            if (extra != null) {this.extra.putAll(extra);} return (A) this;
    }

    public Boolean hasExtra(){
            return this.extra!=null;
    }

    public A addToGroups(int index,String item){
            this.groups.add(index, item); return (A)this;
    }

    public A setToGroups(int index,String item){
            this.groups.set(index, item); return (A)this;
    }

    public A addToGroups(String... items){
            for (String item : items) {this.groups.add(item);} return (A)this;
    }

    public A addAllToGroups(Collection items){
            for (String item : items) {this.groups.add(item);} return (A)this;
    }

    public A removeFromGroups(String... items){
            for (String item : items) {this.groups.remove(item);} return (A)this;
    }

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

    public A withGroups(List groups){
            this.groups.clear();
            if (groups != null) {for (String item : groups){this.addToGroups(item);}} return (A) this;
    }

    public A withGroups(String... groups){
            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 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 boolean equals(Object o){
            if (this == o) return true;
            if (o == null || getClass() != o.getClass()) return false;
            if (!super.equals(o)) return false;
            UserInfoFluentImpl that = (UserInfoFluentImpl) 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;
    }




}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy